Created
January 14, 2011 18:27
-
-
Save thbishop/779997 to your computer and use it in GitHub Desktop.
provides tab completion for boom (bash)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_boom_complete() { | |
local cur prev lists | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
lists=`boom | awk '{print $1}'` | |
case "${prev}" in | |
boom) | |
COMPREPLY=( $(compgen -W "${lists}" -- ${cur}) ) | |
return 0 | |
;; | |
*) | |
for ((i = 0; i < ${#lists}; i++)); do | |
local items=`boom $prev | awk '{print $1}' | sed -e 's/://'` | |
COMPREPLY=( $(compgen -W "${items}" -- ${cur})) | |
return 0 | |
done | |
;; | |
esac | |
} | |
complete -F _boom_complete boom |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment