diff options
Diffstat (limited to 'completions/ccache')
-rw-r--r-- | completions/ccache | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/completions/ccache b/completions/ccache index 80c39de..fb3f3e4 100644 --- a/completions/ccache +++ b/completions/ccache @@ -1,38 +1,40 @@ # ccache(1) completion -*- shell-script -*- -_ccache() +_comp_cmd_ccache() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return local i - for ((i = 1; i <= COMP_CWORD; i++)); do - if [[ ${COMP_WORDS[i]} != -* ]]; then - _command_offset $i + for ((i = 1; i <= cword; i++)); do + if [[ ${words[i]} != -* ]]; then + _comp_command_offset $i return fi - [[ ${COMP_WORDS[i]} == -*[oFM] ]] && ((i++)) + [[ ${words[i]} == -*[oFM] ]] && ((i++)) done + local noargopts='!(-*|*[FMo]*)' + # shellcheck disable=SC2254 case $prev in - --help | --version | --max-files | --max-size | -!(-*)[hVFM]) + --help | --version | --max-files | --max-size | -${noargopts}[hVFM]) return ;; - --set-config | -!(-*)o) + --set-config | -${noargopts}o) if [[ $cur != *=* ]]; then - COMPREPLY=($(compgen -S = -W "$($1 -p 2>/dev/null | - awk '$3 = "=" { print $2 }')" -- "$cur")) + _comp_compgen_split -S = -- "$("$1" -p 2>/dev/null | + _comp_awk '$3 = "=" { print $2 }')" [[ ${COMPREPLY-} == *= ]] && compopt -o nospace fi return ;; esac - $split && return + [[ $was_split ]] && return - COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + _comp_compgen_help [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && - complete -F _ccache ccache + complete -F _comp_cmd_ccache ccache # ex: filetype=sh |