diff --git a/completions/findutils b/completions/findutils index d6e06b11..8590c3d4 100644 --- a/completions/findutils +++ b/completions/findutils @@ -6,10 +6,8 @@ have find || return _find() { - local cur prev i onlyonce - - COMPREPLY=() - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return case $prev in -maxdepth|-mindepth) @@ -48,8 +46,8 @@ _find() return 0 ;; -exec|-execdir|-ok|-okdir) - COMP_WORDS=(COMP_WORDS[0] "$cur") - COMP_CWORD=1 + words=(words[0] "$cur") + cword=1 _command return 0 ;; @@ -68,9 +66,9 @@ _find() _expand || return 0 - local exprfound=false + local i exprfound=false # set exprfound to true if there is already an expression present - for i in ${COMP_WORDS[@]}; do + for i in ${words[@]}; do [[ "$i" = [-\(\),\!]* ]] && exprfound=true && break done @@ -97,6 +95,7 @@ _find() # already been specified somewhere on the command line, as long as # these options can only be used once (in a word, "options", in # opposition to "tests" and "actions", as in the find(1) manpage). + local onlyonce onlyonce=' -daystart -depth -follow -help -ignore_readdir_race -maxdepth \ -mindepth -mount -noignore_readdir_race -noleaf -nowarn -regextype \ -version -warn -xdev ' @@ -111,7 +110,7 @@ _find() # remove word from list of completions COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) done - printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" + printf '%s ' "${COMPREPLY[@]}") <<<"${words[@]}" ) ) _filedir diff --git a/completions/freeciv b/completions/freeciv index 602ad76a..d6e54fd5 100644 --- a/completions/freeciv +++ b/completions/freeciv @@ -3,10 +3,8 @@ have civserver && _civserver() { - local cur prev - - COMPREPLY=() - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return case $prev in -f|-g|-l|-r|--file|--log|--gamelog|--read) @@ -27,10 +25,8 @@ complete -F _civserver civserver have civclient && _civclient() { - local cur prev - - COMPREPLY=() - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return case $prev in -l|-S|-t|--log|--Sound|--tiles) diff --git a/completions/freerdp b/completions/freerdp index 0edef274..93f4119b 100644 --- a/completions/freerdp +++ b/completions/freerdp @@ -4,10 +4,8 @@ have xfreerdp || return _xfreerdp() { - local cur prev - - COMPREPLY=() - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return case $prev in -k) diff --git a/completions/fuse b/completions/fuse index 9228406c..386955e5 100644 --- a/completions/fuse +++ b/completions/fuse @@ -4,9 +4,8 @@ have fusermount || return _fusermount() { - COMPREPLY=() - local cur prev - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return case $prev in -h|-V|-o)