diff options
author | Evax Software <[email protected]> | 2011-04-08 15:21:43 +0200 |
---|---|---|
committer | Evax Software <[email protected]> | 2011-04-08 15:21:43 +0200 |
commit | a0706fe568012549772c6700ee3bfdee826cfb26 (patch) | |
tree | 9a715204b7ba117cc18caf44f775027763171cd1 /bash_completion | |
parent | 6fae12bd978f8b577cdbad92aab862af4299ae86 (diff) | |
download | kerl-a0706fe568012549772c6700ee3bfdee826cfb26.tar.gz kerl-a0706fe568012549772c6700ee3bfdee826cfb26.tar.bz2 kerl-a0706fe568012549772c6700ee3bfdee826cfb26.zip |
Add a bash_completion script for kerl
Diffstat (limited to 'bash_completion')
-rw-r--r-- | bash_completion/kerl | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/bash_completion/kerl b/bash_completion/kerl new file mode 100644 index 0000000..0d1860a --- /dev/null +++ b/bash_completion/kerl @@ -0,0 +1,72 @@ +# bash_completion for kerl + +_kerl() +{ + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + kerl) + COMPREPLY=( $( compgen -W "build install update list delete active status" -- "$cur" ) ) + ;; + list) + COMPREPLY=( $( compgen -W "releases builds installations" -- "$cur" ) ) + ;; + build) + if [ "$COMP_CWORD" -eq 2 ]; then + if [ -f "$HOME/.kerl/otp_releases" ]; then + RELEASES=`cat "$HOME/.kerl/otp_releases"` + fi + COMPREPLY=( $( compgen -W "git $RELEASES" -- "$cur") ) + else + if [ -f "$HOME/.kerl/otp_builds" ]; then + BUILDS=`cat "$HOME/.kerl/otp_builds" | cut -d "," -f 2` + fi + COMPREPLY=( $( compgen -W "$BUILDS" -- "$cur") ) + fi + ;; + installation) + if [ -f "$HOME/.kerl/otp_installations" ]; then + PATHS=`cat "$HOME/.kerl/otp_installations" | cut -d " " -f 2` + fi + COMPREPLY=( $( compgen -W "$PATHS" -- "$cur") ) + ;; + install) + if [ -f "$HOME/.kerl/otp_builds" ]; then + BUILDS=`cat "$HOME/.kerl/otp_builds" | cut -d "," -f 2` + fi + COMPREPLY=( $( compgen -W "$BUILDS" -- "$cur") ) + ;; + delete) + COMPREPLY=( $( compgen -W "build installation $words" -- "$cur") ) + ;; + update) + COMPREPLY=( $( compgen -W "releases agner" -- "$cur") ) + ;; + agner) + if [ "$COMP_CWORD" -eq 3 ]; then + if [ -f "$HOME/.kerl/otp_builds" ]; then + BUILDS=`cat "$HOME/.kerl/otp_builds" | cut -d "," -f 2` + fi + fi + COMPREPLY=( $( compgen -W "$BUILDS" -- "$cur") ) + ;; + *) + if [ "$COMP_CWORD" -eq 3 ]; then + if [ -f "$HOME/.kerl/otp_builds" ]; then + BUILDS=`cat "$HOME/.kerl/otp_builds" | cut -d "," -f 2` + fi + if [ -n "$BUILDS" ]; then + for b in $BUILDS; do + if [ "$prev" = "$b" ]; then + _filedir + return 0 + fi + done + fi + fi + ;; + esac +} +complete -F _kerl kerl + |