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

Ville Skyttä ville.skytta at iki.fi
Tue Oct 20 18:32:43 UTC 2009


The following commit has been merged in the master branch:
commit 2a326a015cbd60863ec96b831c087c288c45039d
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Oct 20 21:17:28 2009 +0300

    Get cvs command options from cvs --help $command.

diff --git a/contrib/cvs b/contrib/cvs
index 429bfcb..b650050 100644
--- a/contrib/cvs
+++ b/contrib/cvs
@@ -33,6 +33,11 @@ _cvs_options()
     cvs --help-options 2>&1 | awk '/^(     *|\t)-/ { print $1 }'
 }
 
+_cvs_command_options()
+{
+    cvs --help $1 2>&1 | sed -ne 's/^[[:space:]]*\(-[^[:space:]=[]*\).*/\1/p'
+}
+
 _cvs()
 {
     local cur count mode i cvsroot cvsroots pwd
@@ -136,18 +141,20 @@ _cvs()
                     COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- $cur ) )
                 fi
             else
-                COMPREPLY=( $( compgen -W '-k -m' -- "$cur" ) )
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             fi
             ;;
         admin)
             if [[ "$cur" = -* ]]; then
-                COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u -L -U -m -M \
-                    -n -N -o -q -I -s -t -t- -T -V -x -z' -- $cur ) )
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             fi
             ;;
         annotate)
             if [[ "$cur" = -* ]]; then
-                COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- "$cur" ) )
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             else
                 get_entries
                 COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
@@ -160,8 +167,8 @@ _cvs()
                     awk '{print $1}' ) )
                 COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
             else
-                COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
-                    -s -r -D -d -k -j' -- "$cur" ) )
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             fi
             ;;
         commit)
@@ -186,7 +193,8 @@ _cvs()
                     COMPREPLY=( $(compgen $default -- "$cur") )
                 fi
             else
-                COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- $cur ) )
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             fi
             ;;
         cvsroot)
@@ -202,7 +210,7 @@ _cvs()
                 COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
                 COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
             else
-                COMPREPLY=( $( compgen -W '-N -f -l -R -n -r -D -d -k' \
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
                     -- "$cur" ) )
             fi
             ;;
@@ -226,7 +234,8 @@ _cvs()
                     COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
                 fi
             else
-                COMPREPLY=( $( compgen -W '-f -l -R' -- "$cur" ) )
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             fi
             ;;
         import)
@@ -243,13 +252,14 @@ _cvs()
                 pwd=${pwd##*/}
                 COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- $cur ) )
             else
-                COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- "$cur" ))
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             fi
             ;;
         update)
             if [[ "$cur" = -* ]]; then
-                COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
-                    -k -r -D -j -I -W' -- "$cur" ) )
+                COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
+                    -- "$cur" ) )
             fi
             ;;
         "")

-- 
bash-completion



More information about the Bash-completion-commits mailing list