diff options
Diffstat (limited to '')
-rw-r--r-- | completions/sitecopy | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/completions/sitecopy b/completions/sitecopy index 8515687..87e8775 100644 --- a/completions/sitecopy +++ b/completions/sitecopy @@ -3,31 +3,33 @@ # 2011 Raphaƫl Droz <raphael.droz+floss@gmail.com> # License: GNU GPL v2 or later -_sitecopy() +_comp_cmd_sitecopy() { - 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='!(-*|*[dgrp]*)' + # shellcheck disable=SC2254 case $prev in - --debug | -!(-*)d) - COMPREPLY=($(compgen -W "socket files rcfile ftp http httpbody - rsh sftp xml xmlparse cleartext" -- "$cur")) + --debug | -${noargopts}d) + _comp_compgen -- -W 'socket files rcfile ftp http httpbody rsh sftp + xml xmlparse cleartext' compopt -o nospace return ;; - --logfile | --rcfile | -!(-*)[gr]) - _filedir + --logfile | --rcfile | -${noargopts}[gr]) + _comp_compgen_filedir return ;; - --storepath | -!(-*)p) - _filedir -d + --storepath | -${noargopts}p) + _comp_compgen_filedir -d return ;; esac case $cur in --*) - COMPREPLY=($(compgen -W "$(_parse_help $1)" -- "$cur")) + _comp_compgen_help [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return ;; @@ -41,10 +43,10 @@ _sitecopy() esac if [[ -r ~/.sitecopyrc ]]; then - COMPREPLY=($(compgen -W "$($1 -v | - command sed -n '/^Site:/s/Site: //p')" -- "$cur")) + _comp_compgen_split -- "$("$1" -v | + command sed -n '/^Site:/s/Site: //p')" fi } && - complete -F _sitecopy -o default sitecopy + complete -F _comp_cmd_sitecopy -o default sitecopy # ex: filetype=sh |