[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-91-g22c8330

Ville Skyttä ville.skytta at iki.fi
Wed Apr 20 14:19:56 UTC 2011


The following commit has been merged in the master branch:
commit 06cf9c2a85bf8ed2086452dfd2b941c021d391a5
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed Apr 20 16:56:50 2011 +0300

    Use _init_completion() in completions/f*.

diff --git a/completions/findutils b/completions/findutils
index d6e06b1..8590c3d 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 602ad76..d6e54fd 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 0edef27..93f4119 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 9228406..386955e 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)

-- 
bash-completion



More information about the Bash-completion-commits mailing list