diff options
Diffstat (limited to 'completions/lzip')
-rw-r--r-- | completions/lzip | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/completions/lzip b/completions/lzip index 05f169c..cd33f60 100644 --- a/completions/lzip +++ b/completions/lzip @@ -1,47 +1,51 @@ # lzip(1) completion -*- shell-script -*- -_lzip() +_comp_cmd_lzip() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return - local decompress=false + local decompress="" + local noargopts='!(-*|*[bmsSBdno]*)' + # shellcheck disable=SC2254 case $prev in --help | --version | --member-size | --match-length | --dictionary-size | \ - --volume-size | --data-size | -!(-*)@([bmsSB]|[hV]*)) + --volume-size | --data-size | -${noargopts}@([bmsSB]|[hV]*)) return ;; - --decompress-!(-*)d) - decompress=true + --decompress | -${noargopts}d) + decompress=set ;; - --threads-!(-*)n) - COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) + --threads | -${noargopts}n) + local REPLY + _comp_get_ncpus + _comp_compgen -- -W "{1..$REPLY}" return ;; - --output-!(-*)o) - _filedir + --output | -${noargopts}o) + _comp_compgen_filedir return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1") {-1..-9}' -- "$cur")) + _comp_compgen_help + _comp_compgen -a -- -W '-{1..9}' [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi - if $decompress; then - _filedir lz + if [[ $decompress ]]; then + _comp_compgen_filedir lz return fi - local IFS=$'\n' compopt -o filenames - COMPREPLY=($(compgen -f -X "*.lz" -- "$cur") $(compgen -d -- "$cur")) + _comp_compgen -- -f -X "*.lz" -o plusdirs } && - complete -F _lzip clzip lzip pdlzip plzip + complete -F _comp_cmd_lzip clzip lzip pdlzip plzip # ex: filetype=sh |