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

Ville Skyttä ville.skytta at iki.fi
Tue Oct 20 06:31:16 UTC 2009


The following commit has been merged in the master branch:
commit 70fd9ca2df320a13ff51c8a7a2a3ba489d9826b6
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Oct 20 09:29:36 2009 +0300

    Add cvs --help command completion, get commands from --help-commands,
    offer the few long options there are rather than corresponding short
    ones.

diff --git a/CHANGES b/CHANGES
index 5e9d7e5..371999f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -15,7 +15,7 @@ bash-completion (1.x)
   * Apply cardctl completion to pccardctl too.
   * Apply pine completion to alpine too.
   * Remove many unnecessary short option completions where long ones exist.
-  * Improve gkrellm, mdadm, and mysqladmin completions.
+  * Improve cvs, gkrellm, mdadm, and mysqladmin completions.
   * Add wtf completion, based on work by Raphaël Droz.
 
  -- David Paleino <d.paleino at gmail.com>  Sun, 11 Oct 2009 11:11:57 +0200
diff --git a/contrib/cvs b/contrib/cvs
index aa2d46c..efde026 100644
--- a/contrib/cvs
+++ b/contrib/cvs
@@ -23,6 +23,11 @@ get_modules()
     fi
 }
 
+_cvs_commands()
+{
+    cvs --help-commands 2>&1 | awk '/^    / { print $1 }'
+}
+
 _cvs()
 {
     local cur count mode i cvsroot cvsroots pwd
@@ -40,6 +45,10 @@ _cvs()
         fi
         if [ -z "$mode" ]; then
             case $i in
+            -H|--help)
+                COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) )
+                return 0
+                ;;
             -d)
                 mode=cvsroot
                 cvsroot=${COMP_WORDS[((count+1))]}
@@ -239,14 +248,9 @@ _cvs()
             fi
             ;;
         "")
-            COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
-                commit diff delete edit export \
-                freeze get history import log new \
-                patch rcs rdiff release remove \
-                rfreeze rlog rm rtag stat status \
-                tag unedit up update -H -Q -q -b \
-                -d -e -f -l -n -t -r -v -w -x -z \
-                --help --version' -- "$cur" ) )
+            COMPREPLY=( $( compgen -W '$( _cvs_commands ) \
+                -Q -q -b -d -e -f -l -n -t -r -w -x -z \
+                --help --help-commands --help-options --version' -- "$cur" ) )
             ;;
         *)
             ;;

-- 
bash-completion



More information about the Bash-completion-commits mailing list