Permalink
Browse files

Added tab completion script

  • Loading branch information...
1 parent be2de6e commit 4750e2a3c5f4a23256cc53c4a954139e92695d7c carlin committed Sep 28, 2009
Showing with 30 additions and 0 deletions.
  1. +30 −0 tab-completion.sh
View
30 tab-completion.sh
@@ -0,0 +1,30 @@
+# Proto tab-completion
+#
+# This assumes you are running proto while in its directory, eg.
+# ~/proto$ ./proto <tab>
+# ~/proto$ ./proto install <tab>
+#
+# To install drop this file into /etc/bash_completion.d/
+# or add this line to your .bashrc:
+# source /path/to/proto/tab-completion.sh
+# and open a new terminal
+
+_proto ()
+{
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ cmds='install update uninstall test showdeps help'
+
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
+ return 0
+ fi
+
+ if [[ $COMP_CWORD -eq 2 ]]; then
+ COMPREPLY=( $( compgen -W '$( command cat projects.list | grep -i '^[a-z0-9\-]*:$' | sed -e 's/://' )' -- $cur ) )
+ return 0
+ fi
+}
+
+complete -F _proto -o default ./proto

0 comments on commit 4750e2a

Please sign in to comment.