[Bash-completion-commits] [SCM] bash-completion branch, master, updated. eb5e62dec1119d8710368f844723900e2bdedfd4

Ville Skyttä ville.skytta at iki.fi
Thu Oct 22 09:11:36 UTC 2009


The following commit has been merged in the master branch:
commit 6862bb45c19fe8e56663dc63eb7b91d31b21a807
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Oct 22 11:15:27 2009 +0300

    bash < 3 support removal step 1: drop unneeded conditional sections.

diff --git a/CHANGES b/CHANGES
index d4f0bc3..b2cacf5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -23,6 +23,7 @@ bash-completion (1.x)
   * Speed up installed rpm package completion on SUSE, based on work by
     Marco Poletti (Alioth: #312021).
   * Improve sourcing snippets from completion dirs.
+  * Drop support for bash < 3.
 
  -- David Paleino <d.paleino at gmail.com>  Sun, 11 Oct 2009 11:11:57 +0200
 
diff --git a/bash_completion b/bash_completion
index 8188637..e0ab946 100644
--- a/bash_completion
+++ b/bash_completion
@@ -662,10 +662,10 @@ _usergroup()
 {
     local IFS=$'\n'
     cur=${cur//\\\\ / }
-    if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
+    if [[ $cur = *@(\\:|.)* ]]; then
         user=${cur%%*([^:.])}
         COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) )
-    elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
+    elif [[ $cur = *:* ]]; then
         COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
     else
         COMPREPLY=( $( compgen -S : -u -- "$cur" ) )
@@ -845,7 +845,7 @@ _chgrp()
 
     # first parameter on line or first since an option?
     if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
-        [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
+        [[ "$prev" == -* ]]; then
         local IFS=$'\n'
         COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
     else
diff --git a/contrib/bash-builtins b/contrib/bash-builtins
index c0af45d..c533a56 100644
--- a/contrib/bash-builtins
+++ b/contrib/bash-builtins
@@ -73,7 +73,7 @@ complete -F _function function declare typeset
 #
 _complete()
 {
-    local cur prev options
+    local cur prev
 
     COMPREPLY=()
     cur=`_get_cword`
@@ -81,10 +81,8 @@ _complete()
 
     case $prev in
         -o)
-            options="default dirnames filenames"
-            [ -n "$bash205b" ] && options="$options nospace"
-            [ -n "$bash3" ] && options="$options bashdefault plusdirs"
-            COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+            COMPREPLY=( $( compgen -W 'bashdefault default dirnames filenames \
+                nospace plusdirs' -- "$cur" ) )
             return 0
             ;;
 
@@ -115,9 +113,8 @@ _complete()
 
     if [[ "$cur" == -* ]]; then
         # relevant options completion
-        options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
-        [ -n "$bash205" ] && options="$options -o"
-        COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+        COMPREPLY=( $( compgen -W '-a -b -c -d -e -f -g -j -k -o -s -v -u -A \
+            -G -W -P -S -X -F -C' -- "$cur" ) )
     else
         COMPREPLY=( $( compgen -A command -- "$cur" ) )
     fi
diff --git a/contrib/findutils b/contrib/findutils
index d77c892..5108f43 100644
--- a/contrib/findutils
+++ b/contrib/findutils
@@ -32,9 +32,7 @@ _find()
         return 0
         ;;
     -group)
-        if [ -n "$bash205" ]; then
-            COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
-        fi
+        COMPREPLY=( $( compgen -g -- "$cur" 2>/dev/null) )
         return 0
         ;;
     -?(x)type)
diff --git a/contrib/shadow b/contrib/shadow
index 0d43986..b7bb351 100644
--- a/contrib/shadow
+++ b/contrib/shadow
@@ -24,14 +24,12 @@ _useradd()
             ;;
         -g|--gid)
             _gids
-            [ -n "$bash205" ] && \
-                COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
-            COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+            COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \
+                -- "$cur" ) )
             return 0
             ;;
         -G|--groups)
-            [ -n "$bash205" ] && \
-                COMPREPLY=( $( compgen -g -- "$cur" ) )
+            COMPREPLY=( $( compgen -g -- "$cur" ) )
             return 0
             ;;
         -s|--shell)
@@ -73,14 +71,12 @@ _usermod()
             ;;
         -g|--gid)
             _gids
-            [ -n "$bash205" ] && \
-                COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
-            COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+            COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $( compgen -g )' \
+                -- "$cur" ) )
             return 0
             ;;
         -G|--groups)
-            [ -n "$bash205" ] && \
-                COMPREPLY=( $( compgen -g -- "$cur" ) )
+            COMPREPLY=( $( compgen -g -- "$cur" ) )
             return 0
             ;;
         -s|--shell)
@@ -316,11 +312,11 @@ _groupmod()
         return 0
     fi
 
-    [ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
+    COMPREPLY=( $( compgen -g -- "$cur" ) )
 } &&
 complete -F _groupmod groupmod
 
-[ -n "$bash205" ] && complete -g groupdel
+complete -g groupdel
 
 have newgrp &&
 _newgrp()
@@ -330,7 +326,7 @@ _newgrp()
         COMPREPLY=( - )
     fi
 } &&
-complete ${bash205:+-g} -F _newgrp newgrp
+complete -g -F _newgrp newgrp
 
 have gpasswd &&
 _gpasswd()
@@ -353,7 +349,7 @@ _gpasswd()
         return 0
     fi
 
-    [ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
+    COMPREPLY=( $( compgen -g -- "$cur" ) )
 } &&
 complete -F _gpasswd gpasswd
 
@@ -372,8 +368,7 @@ _groupmems()
             return 0
             ;;
         -g)
-            [ -n "$bash205" ] && \
-                COMPREPLY=( $( compgen -g -- "$cur" ) )
+            COMPREPLY=( $( compgen -g -- "$cur" ) )
             return 0
             ;;
     esac

-- 
bash-completion



More information about the Bash-completion-commits mailing list