diff options
Diffstat (limited to 'completions/unpack200')
-rw-r--r-- | completions/unpack200 | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/completions/unpack200 b/completions/unpack200 index 8814259..3724f37 100644 --- a/completions/unpack200 +++ b/completions/unpack200 @@ -1,48 +1,50 @@ # unpack200(1) completion -*- shell-script -*- -_unpack200() +_comp_cmd_unpack200() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return + local noargopts='!(-*|*[Hl]*)' + # shellcheck disable=SC2254 case $prev in - --help | --version | -!(-*)[?hVJ]) + --help | --version | -${noargopts}[?hVJ]) return ;; - --deflate-hint | -!(-*)H) - COMPREPLY=($(compgen -W 'true false keep' -- "$cur")) + --deflate-hint | -${noargopts}H) + _comp_compgen -- -W 'true false keep' return ;; - --log-file | -!(-*)l) - COMPREPLY=($(compgen -W '-' -- "$cur")) - _filedir log + --log-file | -${noargopts}l) + _comp_compgen -- -W '-' + _comp_compgen -a filedir log return ;; esac - $split && return + [[ $was_split ]] && return # Check if a pack or a jar was already given. - local word pack=false jar=false + local word pack="" jar="" for word in "${words[@]:1}"; do case $word in - *.pack | *.pack.gz) pack=true ;; - *.jar) jar=true ;; + *.pack | *.pack.gz) pack=set ;; + *.jar) jar=set ;; esac done - if ! $pack; then + if [[ ! $pack ]]; then if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '--deflate-hint= --remove-pack-file - --verbose --quiet --log-file= --help --version' -- "$cur")) + _comp_compgen -- -W '--deflate-hint= --remove-pack-file --verbose + --quiet --log-file= --help --version' [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else - _filedir 'pack?(.gz)' + _comp_compgen_filedir 'pack?(.gz)' fi - elif ! $jar; then - _filedir jar + elif [[ ! $jar ]]; then + _comp_compgen_filedir jar fi } && - complete -F _unpack200 unpack200 + complete -F _comp_cmd_unpack200 unpack200 # ex: filetype=sh |