Use _init_completion() in completions/f*.
This commit is contained in:
parent
ca6f748f98
commit
06cf9c2a85
@ -6,10 +6,8 @@ have find || return
|
|||||||
|
|
||||||
_find()
|
_find()
|
||||||
{
|
{
|
||||||
local cur prev i onlyonce
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-maxdepth|-mindepth)
|
-maxdepth|-mindepth)
|
||||||
@ -48,8 +46,8 @@ _find()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-exec|-execdir|-ok|-okdir)
|
-exec|-execdir|-ok|-okdir)
|
||||||
COMP_WORDS=(COMP_WORDS[0] "$cur")
|
words=(words[0] "$cur")
|
||||||
COMP_CWORD=1
|
cword=1
|
||||||
_command
|
_command
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
@ -68,9 +66,9 @@ _find()
|
|||||||
|
|
||||||
_expand || return 0
|
_expand || return 0
|
||||||
|
|
||||||
local exprfound=false
|
local i exprfound=false
|
||||||
# set exprfound to true if there is already an expression present
|
# 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
|
[[ "$i" = [-\(\),\!]* ]] && exprfound=true && break
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -97,6 +95,7 @@ _find()
|
|||||||
# already been specified somewhere on the command line, as long as
|
# already been specified somewhere on the command line, as long as
|
||||||
# these options can only be used once (in a word, "options", in
|
# these options can only be used once (in a word, "options", in
|
||||||
# opposition to "tests" and "actions", as in the find(1) manpage).
|
# opposition to "tests" and "actions", as in the find(1) manpage).
|
||||||
|
local onlyonce
|
||||||
onlyonce=' -daystart -depth -follow -help -ignore_readdir_race -maxdepth \
|
onlyonce=' -daystart -depth -follow -help -ignore_readdir_race -maxdepth \
|
||||||
-mindepth -mount -noignore_readdir_race -noleaf -nowarn -regextype \
|
-mindepth -mount -noignore_readdir_race -noleaf -nowarn -regextype \
|
||||||
-version -warn -xdev '
|
-version -warn -xdev '
|
||||||
@ -111,7 +110,7 @@ _find()
|
|||||||
# remove word from list of completions
|
# remove word from list of completions
|
||||||
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
|
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
|
||||||
done
|
done
|
||||||
printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}"
|
printf '%s ' "${COMPREPLY[@]}") <<<"${words[@]}"
|
||||||
) )
|
) )
|
||||||
|
|
||||||
_filedir
|
_filedir
|
||||||
|
@ -3,10 +3,8 @@
|
|||||||
have civserver &&
|
have civserver &&
|
||||||
_civserver()
|
_civserver()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-f|-g|-l|-r|--file|--log|--gamelog|--read)
|
-f|-g|-l|-r|--file|--log|--gamelog|--read)
|
||||||
@ -27,10 +25,8 @@ complete -F _civserver civserver
|
|||||||
have civclient &&
|
have civclient &&
|
||||||
_civclient()
|
_civclient()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-l|-S|-t|--log|--Sound|--tiles)
|
-l|-S|-t|--log|--Sound|--tiles)
|
||||||
|
@ -4,10 +4,8 @@ have xfreerdp || return
|
|||||||
|
|
||||||
_xfreerdp()
|
_xfreerdp()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-k)
|
-k)
|
||||||
|
@ -4,9 +4,8 @@ have fusermount || return
|
|||||||
|
|
||||||
_fusermount()
|
_fusermount()
|
||||||
{
|
{
|
||||||
COMPREPLY=()
|
local cur prev words cword
|
||||||
local cur prev
|
_init_completion || return
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-h|-V|-o)
|
-h|-V|-o)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user