diff options
Diffstat (limited to '')
-rw-r--r-- | completions/file | 26 | ||||
-rw-r--r-- | completions/file-roller | 34 | ||||
-rw-r--r-- | completions/filefrag | 12 | ||||
-rw-r--r-- | completions/filesnarf | 12 |
4 files changed, 44 insertions, 40 deletions
diff --git a/completions/file b/completions/file index 21fbd16..7b07d40 100644 --- a/completions/file +++ b/completions/file @@ -1,32 +1,34 @@ # file(1) completion -*- shell-script -*- -_file() +_comp_cmd_file() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return + local noargopts='!(-*|*[Fmfe]*)' + # shellcheck disable=SC2254 case $prev in - --help | --version | --separator | -!(-*)[vF]) + --help | --version | --separator | -${noargopts}[vF]) return ;; - --magic-file | --files-from | -!(-*)[mf]) - _filedir + --magic-file | --files-from | -${noargopts}[mf]) + _comp_compgen_filedir return ;; - --exclude | -!(-*)e) - COMPREPLY=($(compgen -W 'apptype ascii cdf compress elf encoding - soft tar text tokens troff' -- "$cur")) + --exclude | -${noargopts}e) + _comp_compgen -- -W 'apptype ascii cdf compress elf encoding soft + tar text tokens troff' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + _comp_compgen_help return fi - _filedir + _comp_compgen_filedir } && - complete -F _file file + complete -F _comp_cmd_file file # ex: filetype=sh diff --git a/completions/file-roller b/completions/file-roller index 1d223fd..cd745ac 100644 --- a/completions/file-roller +++ b/completions/file-roller @@ -1,42 +1,44 @@ # file-roller(1) completion -*- shell-script -*- -_file_roller() +_comp_cmd_file_roller() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return - local exts='@(7z|ace|alz|ar|arj|[bglx]z|bz2|tb?(z)2|cab|cb[rz]|iso?(9660)|Z|t[abglx]z|cpio|deb|rar|?(g)tar|gem|lh[az]|lz[4h]|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)' + local exts='@(7z?(.001)|ace|alz|ar|arj|[bglx]z|bz2|tb?(z)2|cab|cb[rz]|iso?(9660)|Z|t[abglx]z|cpio|deb|rar|?(g)tar|gem|lh[az]|lz[4h]|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo|?(t)zst)' + local noargopts='!(-*|*[ae]*)' + # shellcheck disable=SC2254 case $prev in - --help | --help-all | --help-gtk | --help-sm-client | -!(-*)'?') + --help | --help-all | --help-gtk | --help-sm-client | -${noargopts}'?') return ;; --sm-client-state-file) - _filedir + _comp_compgen_filedir return ;; - --add-to | -!(-*)a) - _filedir_xspec unzip - _filedir "$exts" + --add-to | -${noargopts}a) + _comp_compgen_filedir_xspec unzip + _comp_compgen -a filedir "$exts" return ;; - --extract-to | --default-dir | -!(-*)e) - _filedir -d + --extract-to | --default-dir | -${noargopts}e) + _comp_compgen_filedir -d return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1" --help-all)' -- "$cur")) + _comp_compgen_help -- --help-all [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi - _filedir_xspec unzip - _filedir "$exts" + _comp_compgen_filedir_xspec unzip + _comp_compgen -a filedir "$exts" } && - complete -F _file_roller file-roller + complete -F _comp_cmd_file_roller file-roller # ex: filetype=sh diff --git a/completions/filefrag b/completions/filefrag index d26e8c8..6de8a19 100644 --- a/completions/filefrag +++ b/completions/filefrag @@ -1,17 +1,17 @@ # filefrag(8) completion -*- shell-script -*- -_filefrag() +_comp_cmd_filefrag() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + _comp_compgen_usage return fi - _filedir + _comp_compgen_filedir } && - complete -F _filefrag filefrag + complete -F _comp_cmd_filefrag filefrag # ex: filetype=sh diff --git a/completions/filesnarf b/completions/filesnarf index f959d80..d4c1cb0 100644 --- a/completions/filesnarf +++ b/completions/filesnarf @@ -1,22 +1,22 @@ # filesnarf etc completion -*- shell-script -*- -_snarf() +_comp_cmd_snarf() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in -i) - _available_interfaces -a + _comp_compgen_available_interfaces -a return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur")) + _comp_compgen_usage fi } && - complete -F _snarf filesnarf mailsnarf msgsnarf + complete -F _comp_cmd_snarf filesnarf mailsnarf msgsnarf # ex: filetype=sh |