diff options
Diffstat (limited to 'completions/gpgv')
-rw-r--r-- | completions/gpgv | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/completions/gpgv b/completions/gpgv index 29315c9..7609a33 100644 --- a/completions/gpgv +++ b/completions/gpgv @@ -1,29 +1,30 @@ # gpgv(1) completion -*- shell-script -*- -_gpgv() +_comp_cmd_gpgv() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in --help | --version | --weak-digest | --*-fd | -!(-*)[?h]*) return ;; --keyring) - _filedir "@(gpg|kbx)" + _comp_compgen_filedir "@(gpg|kbx)" return ;; --homedir) - _filedir -d + _comp_compgen_filedir -d return ;; esac - local args - _count_args "" "--@(weak-digest|*-fd|keyring|homedir)" + local REPLY + _comp_count_args -a "--@(weak-digest|*-fd|keyring|homedir)" + local args=$REPLY if [[ $cur == -* && $args -eq 1 ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + _comp_compgen_help return fi @@ -31,16 +32,16 @@ _gpgv() if [[ ${COMP_LINE,,} == *.@(asc|sig|sign)\ * ]]; then # Detached signature, only complete one arbitrary file arg and - if ((args == 2)); then - COMPREPLY=($(compgen -W '-' -- "$cur")) - _filedir + _comp_compgen -- -W '-' + _comp_compgen -a filedir fi else - _filedir gpg + _comp_compgen_filedir gpg fi else - _filedir "@(asc|gpg|sig|sign)" + _comp_compgen_filedir "@(asc|gpg|sig|sign)" fi } && - complete -F _gpgv gpgv gpgv2 + complete -F _comp_cmd_gpgv gpgv gpgv2 # ex: filetype=sh |