metaforce/hecl/extra/hecl_autocomplete.sh

27 lines
581 B
Bash
Raw Normal View History

2015-05-19 21:01:32 +00:00
#!/bin/bash
_hecl ()
{
local word=${COMP_WORDS[COMP_CWORD]}
2015-05-20 05:22:32 +00:00
local filecmds=(init 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-05-20 05:22:32 +00:00
init|add|remove|group|cook|clean|package)
2015-05-19 21:01:32 +00:00
COMPREPLY=($(compgen -f -- "${word}"))
;;
help)
COMPREPLY=($(compgen -W "${filecmds[*]}" "${word}"))
;;
esac
fi
}
complete -F _hecl hecl