add mocha-suv bash completion script; install to /etc/bash_completion.d/
This commit is contained in:
parent
2cd67ed02c
commit
8008f6268f
@ -0,0 +1,41 @@
|
||||
# Mocha command line completion -*- shell-script -*-
|
||||
|
||||
_mocha()
|
||||
{
|
||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||
_init_completion || return
|
||||
|
||||
for (( i=1; i < ${#words[@]}; i++ )); do
|
||||
if [[ " ${COMMANDS[*]} " == *" ${words[i]} "* ]]; then
|
||||
command=${words[i]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
#COMPREPLY=()
|
||||
if [[ $cur == -* || ( -v command && $COMP_CWORD -le $i ) ]]; then
|
||||
case $prev in
|
||||
mocha)
|
||||
COMPREPLY=( $( compgen -W "oms suv" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
suv)
|
||||
COMPREPLY=( $( compgen -W "new up down delete shell status list" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
up|down|delete|shell|status)
|
||||
COMPREPLY=( $( compgen -W "$(ls /home/beckermj/Documents/Vagrant/mocha/machines)" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return
|
||||
fi
|
||||
|
||||
#COMPREPLY=( $( compgen -W "oms suv" -- "$cur" ) )
|
||||
return 0
|
||||
} &&
|
||||
|
||||
complete -F _mocha mocha
|
||||
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user