Closed hansode closed 9 years ago
$ cat mussel-completion.sh
_mussel.sh() { local cur= prev= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local tasks_ro="index show" local tasks_rw="${tasks_ro} update destroy" case "${prev}" in image | network ) COMPREPLY=( $(compgen -W "${tasks_ro}" -- ${cur}) ) return 0 ;; ssh_key_pair | security_group ) COMPREPLY=( $(compgen -W "${tasks_rw}" -- ${cur}) ) return 0 ;; instance) COMPREPLY=( $(compgen -W "${tasks_rw} poweroff poweron backup" -- ${cur}) ) return 0 ;; load_balancer) COMPREPLY=( $(compgen -W "${tasks_rw} register unregister" -- ${cur}) ) return 0 ;; esac local namespaces=" image instance load_balancer network security_group ssh_key_pair " COMPREPLY=( $( compgen -W "${namespaces}" ${cur} ) ) } complete -F _mussel.sh mussel.sh