Use _init_completion() in completions/f*.

This commit is contained in:
Ville Skyttä 2011-04-20 16:56:50 +03:00
parent ca6f748f98
commit 06cf9c2a85
4 changed files with 16 additions and 24 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)