diff options
Diffstat (limited to 'completions/lrzip')
-rw-r--r-- | completions/lrzip | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/completions/lrzip b/completions/lrzip index eb2904c..6f40be7 100644 --- a/completions/lrzip +++ b/completions/lrzip @@ -1,52 +1,56 @@ # lrzip(1) completion -*- shell-script -*- -_lrzip() +_comp_cmd_lrzip() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return local xspec="*.lrz" + local noargopts='!(-*|*[SmwdoOLNp]*)' + # shellcheck disable=SC2254 case $prev in - -*@([wSm]|[Vh?]*)) + --help | --version | --suffix | --maxram | --window | \ + -${noargopts}@([Smw]|[h?V]*)) return ;; - -*d) + --decompress | -${noargopts}d) xspec="!"$xspec ;; - -*o) - _filedir + --outfile | -${noargopts}o) + _comp_compgen_filedir return ;; - -*O) - _filedir -d + --outdir | -${noargopts}O) + _comp_compgen_filedir -d return ;; - -*L) - COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) + --level | -${noargopts}L) + _comp_compgen -- -W '{1..9}' return ;; - -*N) - COMPREPLY=($(compgen -W '{-20..19}' -- "$cur")) + --nice-level | -${noargopts}N) + _comp_compgen -- -W '{-20..19}' return ;; - -*p) - COMPREPLY=($(compgen -W "{1..$(_ncpus)}" -- "$cur")) + --threads | -${noargopts}p) + local REPLY + _comp_get_ncpus + _comp_compgen -- -W "{1..$REPLY}" return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + _comp_compgen_help return fi - _tilde "$cur" || return + _comp_compgen_tilde && return - local IFS=$'\n' compopt -o filenames - COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) + _comp_compgen -- -f -X "$xspec" -o plusdirs } && - complete -F _lrzip lrzip + complete -F _comp_cmd_lrzip lrzip # ex: filetype=sh |