[Sheepdog] [PATCH] add the bash completeion script for shepherd

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Sun May 9 02:25:39 CEST 2010


Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 script/bash_completion_shepherd |   47 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100644 script/bash_completion_shepherd

diff --git a/script/bash_completion_shepherd b/script/bash_completion_shepherd
new file mode 100644
index 0000000..08ae082
--- /dev/null
+++ b/script/bash_completion_shepherd
@@ -0,0 +1,47 @@
+#!bash
+
+_shepherd()
+{
+	local opts cur prev
+	opts="cluster node vdi vm"
+	cur="${COMP_WORDS[COMP_CWORD]}"
+	prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+	case "${prev}" in
+		cluster)
+	     	COMPREPLY=( $( \
+		    compgen -W "info format shutdown" \
+		    ${COMP_WORDS[COMP_CWORD]}
+	    	))
+	    	return 0
+	    	;;
+
+		node)
+	     	COMPREPLY=( $( \
+		    compgen -W "info list" \
+		    ${COMP_WORDS[COMP_CWORD]}
+	    	))
+	    	return 0
+	    	;;
+
+		vdi)
+	     	COMPREPLY=( $( \
+		    compgen -W "list delete object lock release" \
+		    ${COMP_WORDS[COMP_CWORD]}
+	    	))
+	    	return 0
+	    	;;
+
+		vm)
+	     	COMPREPLY=( $( \
+		    compgen -W "list" \
+		    ${COMP_WORDS[COMP_CWORD]}
+	    	))
+	    	return 0
+	    	;;
+	esac
+
+	COMPREPLY=( $( compgen -W "${opts}" ${cur} ) )
+}
+
+complete -F _shepherd shepherd
-- 
1.6.5




More information about the sheepdog mailing list