Hi,

On Wed, Feb 21, 2007 at 09:07:48PM -0800, Nathaniel Smith wrote:
> On Wed, Feb 21, 2007 at 10:59:51PM +0000, Matthew Sackman wrote:
> > These are really minor improvements which add branch selectors: i.e. I
> > often do mtn update -r h:some.branch.I.want.to.switch.to
> > 
> > Patch made against last update to contrib/monotone.bash_completion
> 
> Committed.  Thanks!

Wow, that was quick. Thus I feel compelled to do more! Attached is a
further patch, which should be applied after yesterday's patch. It now
makes bash completions fully support a: b: h: i: and t: selectors on
their own and as composites.

Cheers,

Matthew
--- Desktop/contrib-monotone.bash_completion	2007-02-22 14:17:27.000000000 +0000
+++ contrib-monotone.bash_completion	2007-02-22 14:16:09.000000000 +0000
@@ -71,6 +71,26 @@
   prev=${COMP_WORDS[COMP_CWORD-1]}
 
   case $cur in
+    */a:!(*/[[:alpha:]]:*) | *=a:!(*/[[:alpha:]]:*) | a:!(*/[[:alpha:]]:*) )
+      cur="${cur##*a:}"
+      _monotone_keys pubkey
+      ;;      
+    */b:!(*/[[:alpha:]]:*) | *=b:!(*/[[:alpha:]]:*) | b:!(*/[[:alpha:]]:*) )
+      cur="${cur##*b:}"
+      _monotone_branches
+      ;;      
+    */h:!(*/[[:alpha:]]:*) | *=h:!(*/[[:alpha:]]:*) | h:!(*/[[:alpha:]]:*) )
+      cur="${cur##*h:}"
+      _monotone_branches
+      ;;      
+    */i:!(*/[[:alpha:]]:*) | *=i:!(*/[[:alpha:]]:*) | i:!(*/[[:alpha:]]:*) )
+      cur="${cur##*i:}"
+      _monotone_complete revision
+      ;;      
+    */t:!(*/[[:alpha:]]:*) | *=t:!(*/[[:alpha:]]:*) | t:!(*/[[:alpha:]]:*) )
+      cur="${cur##*t:}"
+      _monotone_tags
+      ;;      
     --db=* | --rcfile=* | --dump=* )
       cur="${cur#*=}"
       _filedir
@@ -89,10 +109,6 @@
       cur="${cur#*=}"
       COMPREPLY=( $(compgen -W 'count dot none' -- $cur ) )
       ;;
-    --revision=h:* )
-      cur="${cur#*=h:}"
-      _monotone_branches
-      ;;
     --revision=* )
       cur="${cur#*=}"
       _monotone_complete revision
@@ -151,15 +167,7 @@
           COMPREPLY=( $(compgen -W 'count dot none' -- $cur ) )
           ;;
         --revision | -r )
-	  case $cur in
-	      h:* )
-	      cur="${cur#*h:}"
-	      _monotone_branches
-	      ;;
-	      * )
-	      _monotone_complete revision
-	      ;;
-	  esac
+	  _monotone_complete revision
           ;;
         db )
           COMPREPLY=( $(compgen -W 'init info version dump load migrate execute
_______________________________________________
Monotone-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/monotone-devel

Reply via email to