[Pkg-bazaar-commits] ./bzr/unstable r331: - sketchy experiments in bash and zsh completion

Martin Pool mbp at sourcefrog.net
Fri Apr 10 07:43:46 UTC 2009


------------------------------------------------------------
revno: 331
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Tue 2005-05-03 17:48:54 +1000
message:
  - sketchy experiments in bash and zsh completion
added:
  contrib/
  contrib/bash/
  contrib/bash/bzr
  contrib/zsh/
  contrib/zsh/_bzr
-------------- next part --------------
=== added directory 'contrib'
=== added directory 'contrib/bash'
=== added file 'contrib/bash/bzr'
--- a/contrib/bash/bzr	1970-01-01 00:00:00 +0000
+++ b/contrib/bash/bzr	2005-05-03 07:48:54 +0000
@@ -0,0 +1,28 @@
+# -*- shell-script -*-
+
+# experimental bzr bash completion
+
+# author: Martin Pool
+
+_bzr_commands() 
+{
+     bzr help commands | grep '^   '
+}
+
+_bzr() 
+{
+    cur=${COMP_WORDS[COMP_CWORD]}
+    prev=${COMP_WORDS[COMP_CWORD-1]}
+    if [ $COMP_CWORD -eq 1 ]; then
+        COMPREPLY=( $( compgen -W "$(_bzr_commands)" $cur ) )
+    elif [ $COMP_CWORD -eq 2 ]; then
+        case "$prev" in 
+        help)
+            COMPREPLY=( $( compgen -W "$(_bzr_commands) commands" $cur ) )
+            ;;
+        esac
+    fi 
+}
+
+complete -F _bzr bzr
+

=== added directory 'contrib/zsh'
=== added file 'contrib/zsh/_bzr'
--- a/contrib/zsh/_bzr	1970-01-01 00:00:00 +0000
+++ b/contrib/zsh/_bzr	2005-05-03 07:48:54 +0000
@@ -0,0 +1,11 @@
+#compdef bzr
+
+# Rudimentary zsh completion support for bzr.
+
+# -S means there are no options after a -- and that argument is ignored
+
+# To use this you must arrange for it to be in a directory that is on
+# your $fpath, and also for compinit to be run.
+
+
+_arguments -S "1::bzr command:($(bzr help commands | grep '^   '))"



More information about the Pkg-bazaar-commits mailing list