[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:57 UTC 2011


The following commit has been merged in the master branch:
commit 10f6eb8ee23b1c3cdeca29f7a58eb0750dab9c3d
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed Apr 20 17:02:27 2011 +0300

    Use _init_completion() in completions/g*.

diff --git a/completions/gcc b/completions/gcc
index b5d6095..306bbd4 100644
--- a/completions/gcc
+++ b/completions/gcc
@@ -12,13 +12,13 @@ have gcc || return
 
 _gcc()
 {
-    local cur cc backend
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur
+    local cur prev words cword
+    _init_completion || return
 
     _expand || return 0
 
+    local cc backend
+
     case $1 in
         gcj)
             backend=jc1
diff --git a/completions/gcl b/completions/gcl
index 4ca03b6..d4e0cb3 100644
--- a/completions/gcl
+++ b/completions/gcl
@@ -5,10 +5,8 @@ have gcl || return
 
 _gcl()
 {
-    local cur
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur
+    local cur prev words cword
+    _init_completion || return
 
     # completing an option (may or may not be separated by a space)
     if [[ "$cur" == -* ]]; then
diff --git a/completions/gdb b/completions/gdb
index 063bb29..f59f2b1 100644
--- a/completions/gdb
+++ b/completions/gdb
@@ -4,12 +4,10 @@ have gdb || return
 
 _gdb()
 {
-    local cur prev
+    local cur prev words cword
+    _init_completion || return
 
-    COMPREPLY=()
-    _get_comp_words_by_ref cur prev
-
-    if [ $COMP_CWORD -eq 1 ]; then
+    if [ $cword -eq 1 ]; then
         local IFS
         _compopt_o_filenames
         if [[ "$cur" == */* ]]; then
@@ -28,7 +26,7 @@ _gdb()
                 -mindepth 1 -maxdepth 1 -not -type d -executable \
                 -printf "%f\\n" 2>/dev/null)' -- "$cur" ) )
         fi
-    elif [ $COMP_CWORD -eq 2 ]; then
+    elif [ $cword -eq 2 ]; then
         prev=${prev##*/}
         COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
             awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" ) )
diff --git a/completions/genisoimage b/completions/genisoimage
index 51bf458..77d7262 100644
--- a/completions/genisoimage
+++ b/completions/genisoimage
@@ -4,10 +4,8 @@ have mkisofs || have genisoimage || return
 
 _mkisofs()
 {
-    local cur prev
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur prev
+    local cur prev words cword
+    _init_completion || return
 
     case $prev in
         -o|-abstract|-biblio|-check-session|-copyright|-log-file| \
diff --git a/completions/getent b/completions/getent
index 68c07e0..4564acc 100644
--- a/completions/getent
+++ b/completions/getent
@@ -4,10 +4,8 @@ have getent || return
 
 _getent()
 {
-    local cur prev
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur prev
+    local cur prev words cword
+    _init_completion || return
 
     case $prev in
         passwd)
@@ -39,7 +37,7 @@ _getent()
     esac
 
 
-    if [ $COMP_CWORD -eq 1 ]; then
+    if [ $cword -eq 1 ]; then
         COMPREPLY=( $( compgen -W 'passwd group hosts services protocols \
             networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \
             shadow' -- "$cur" ) )
diff --git a/completions/gkrellm b/completions/gkrellm
index a063c5e..fabd7ca 100644
--- a/completions/gkrellm
+++ b/completions/gkrellm
@@ -4,10 +4,8 @@ have gkrellm || have gkrellm2 || return
 
 _gkrellm()
 {
-    local cur prev
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur prev
+    local cur prev words cword
+    _init_completion || return
 
     case $prev in
         -t|--theme)
diff --git a/completions/gnatmake b/completions/gnatmake
index 312f651..540e6e1 100644
--- a/completions/gnatmake
+++ b/completions/gnatmake
@@ -4,10 +4,8 @@ have gnatmake || return
 
 _gnatmake()
 {
-    local cur
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur
+    local cur prev words cword
+    _init_completion || return
 
     if [[ "$cur" == -* ]]; then
         # relevant (and less relevant ;-) )options completion
diff --git a/completions/gpg b/completions/gpg
index 86ff14b..8e16f30 100644
--- a/completions/gpg
+++ b/completions/gpg
@@ -4,10 +4,8 @@ have gpg || return
 
 _gpg()
 {
-    local cur prev
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur prev
+    local cur prev words cword
+    _init_completion || return
 
     case $prev in
         -s|--sign|--clearsign|--decrypt-files|--load-extension)
diff --git a/completions/gpg2 b/completions/gpg2
index df80825..1a4649c 100644
--- a/completions/gpg2
+++ b/completions/gpg2
@@ -4,10 +4,8 @@ have gpg2 || return
 
 _gpg2()
 {
-    local cur prev
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur prev
+    local cur prev words cword
+    _init_completion || return
 
     case $prev in
         --homedir)
diff --git a/completions/gzip b/completions/gzip
index e63e7b9..5699701 100644
--- a/completions/gzip
+++ b/completions/gzip
@@ -4,10 +4,8 @@ have gzip || have pigz || return
 
 _gzip()
 {
-    local cur prev xspec
-
-    COMPREPLY=()
-    _get_comp_words_by_ref cur prev
+    local cur prev words cword
+    _init_completion || return
 
     case $prev in
         -b|--blocksize|-p|--processes|-S|--suffix|-h|--help|-V|--version)
@@ -16,15 +14,14 @@ _gzip()
     esac
 
     if [[ "$cur" == -* ]]; then
-        local helpopts=`_parse_help ${COMP_WORDS[0]}`
+        local helpopts=`_parse_help ${words[0]}`
         COMPREPLY=( $( compgen -W "$helpopts -1 -2 -3 -4 -5 -6 -7 -8 -9" \
             -- "$cur" ) )
         return 0
     fi
 
-    local IFS=$'\n'
+    local IFS=$'\n' xspec="*.@(gz|t[ag]z)"
 
-    xspec="*.@(gz|t[ag]z)"
     if [[ "$prev" == --* ]]; then
         [[ "$prev" == --decompress || \
             "$prev" == --list || \
@@ -33,10 +30,6 @@ _gzip()
     elif [[ "$prev" == -* ]]; then
         [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
         [[ "$prev" == -*f* ]] && xspec=
-    elif [[ "$prev" == '>' || "$prev" == '>>' ]]; then
-        xspec=
-    elif [ "$prev" = '<' ]; then
-        xspec=
     fi
 
     _expand || return 0

-- 
bash-completion



More information about the Bash-completion-commits mailing list