diff options
Diffstat (limited to 'completions/slapt-src')
-rw-r--r-- | completions/slapt-src | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/completions/slapt-src b/completions/slapt-src index 94ddb892..2f65415f 100644 --- a/completions/slapt-src +++ b/completions/slapt-src @@ -2,8 +2,8 @@ _slapt_src() { - local cur prev words cword - _init_completion -n : || return + local cur prev words cword split + _init_completion -s -n : || return case "$prev" in --config|-c) @@ -16,6 +16,8 @@ _slapt_src() ;; esac + $split && return + if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace @@ -25,7 +27,7 @@ _slapt_src() local i t # search for last action (-i|-w|-b|-f) for (( i=${#words[@]}-1; i>0; i-- )); do - if [[ ${words[i]} == -@(i|w|f|b|-install|-show|-build|-fetch) ]]; then + if [[ ${words[i]} == -@([iwfb]|-install|-show|-build|-fetch) ]]; then t="all" break fi @@ -39,6 +41,11 @@ _slapt_src() for (( i=${#words[@]}-1; i>0; i-- )); do if [[ ${words[i]} == -@(c|-config) ]]; then config="${words[i+1]}" + __expand_tilde_by_ref config + break + fi + if [[ ${words[i]} == --config=?* ]]; then + config="${words[i]#*=}" break fi done @@ -47,12 +54,14 @@ _slapt_src() if [[ "$cur" == *:* ]]; then local name=${cur%:*} local version=${cur##*:} - COMPREPLY=( $( slapt-src --config "$config" --search "^$name" 2> \ - /dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) ) + COMPREPLY=( $( LC_ALL=C "$1" --config "$config" --search "^$name" 2> \ + /dev/null | LC_ALL=C command sed -ne \ + "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) ) else - COMPREPLY=( $( slapt-src --config "$config" --search "^$cur" 2> \ - /dev/null | sed -ne "/^$cur/{s/ .*$//;p}" ) ) + COMPREPLY=( $( LC_ALL=C "$1" --config "$config" --search "^$cur" 2> \ + /dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}" ) ) fi -} && complete -F _slapt_src slapt-src +} && +complete -F _slapt_src slapt-src -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh |