diff --git a/contrib/bee-completion.sh b/contrib/bee-completion.sh new file mode 100755 index 0000000..3d16e1e --- /dev/null +++ b/contrib/bee-completion.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +_bee_completion() +{ + COMPREPLY=() + + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + options="init install remove check query list" + ls=$(ls $pwd) + + if [ "${prev}" = "bee" ]; then + COMPREPLY=($(compgen -W "${options} ${ls}" -- ${cur}) ) + return 0 + fi + + packages=$(bee list -a) + COMPREPLY=($(compgen -W "${packages} ${ls}" -- ${cur}) ) + + return 0 +} + +complete -F _bee_completion bee