picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 42d4cd419b59d2e38c159e375b8b14234157eb62
parent d7a4d7b331f1735bbac9cabd5a136041a898f35d
Author: Alexander Burger <abu@software-lab.de>
Date:   Mon,  2 Apr 2012 08:19:43 +0200

Improved bash completion argument handling
Diffstat:
Mlib/bash_completion | 17++++++++++++-----
Mlib/complete.l | 12+++++++-----
2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/lib/bash_completion b/lib/bash_completion @@ -1,15 +1,22 @@ -# Bash completion for pil (picolisp front-end) +# Bash completion for picolisp + pil # Alexander Burger <abu@software-lab.de> have pil && _pil() { - local cur + local CMD=$( + echo ${COMP_WORDS[0]} + for I in $(seq $((COMP_CWORD-1))) + do + local ARG="${COMP_WORDS[$I]}" + test "${ARG:0:1}" = "-" || echo "$ARG" + done ) + local IFS=$'\n' - _get_comp_words_by_ref cur - COMPREPLY=($(${COMP_WORDS[0]} @lib/complete.l "$cur" -bye +)) + COMPREPLY=($($CMD /usr/lib/picolisp/lib/complete.l "${COMP_WORDS[$COMP_CWORD]}" -bye +)) return 0 } && -complete -F _pil pil +complete -o nospace -F _pil picolisp && +complete -o nospace -F _pil pil # ex: ts=4 sw=4 et filetype=sh diff --git a/lib/complete.l b/lib/complete.l @@ -1,4 +1,4 @@ -# 30dec11abu +# 02apr12abu # (c) Software Lab. Alexander Burger (if (opt) @@ -12,13 +12,15 @@ (and (pre? "Str" "Sym") (getd "Sym") - (prinl "Pre" "Sym") ) ) ) ) + (prinl "Pre" "Sym" (and (= "-" "Pre") " ")) ) ) ) ) (let ("Path" (rot (split "Lst" "/")) "Str" (pack (car "Path"))) (setq "Path" (and (cdr "Path") (pack (glue "/" @) "/"))) (for "Sym" (dir "Path" T) - (and - (pre? "Str" "Sym") - (prinl "Path" "Sym") ) ) ) ) ) + (when (pre? "Str" "Sym") + (prinl "Path" "Sym" + (if (=T (car (info (pack "Path" "Sym")))) + "/" + " " ) ) ) ) ) ) ) (prinl '+) ) # vi:et:ts=3:sw=3