metaforce/hecl/extra/hecl_autocomplete.sh

30 lines
696 B
Bash
Raw Permalink Normal View History

2015-05-19 21:01:32 +00:00
#!/bin/bash
_hecl ()
{
local word=${COMP_WORDS[COMP_CWORD]}
2015-06-12 09:08:49 +00:00
local filecmds=(init spec extract add remove group cook clean package)
2015-05-19 21:01:32 +00:00
if [ $COMP_CWORD == 1 ]
then
COMPREPLY=($(compgen -W "${filecmds[*]} help" "${word}"))
return 0
elif [ $COMP_CWORD == 2 ]
then
case ${COMP_WORDS[1]} in
2015-06-12 09:08:49 +00:00
init|extract|add|remove|group|cook|clean|package)
2015-05-19 21:01:32 +00:00
COMPREPLY=($(compgen -f -- "${word}"))
;;
2015-06-09 23:21:45 +00:00
spec)
2015-06-09 22:19:59 +00:00
COMPREPLY=($(compgen -W "enable disable" "${word}"))
;;
2015-05-19 21:01:32 +00:00
help)
COMPREPLY=($(compgen -W "${filecmds[*]}" "${word}"))
;;
esac
fi
}
complete -F _hecl hecl