Skip to content

Instantly share code, notes, and snippets.

@thbishop
Created January 14, 2011 18:27
Show Gist options
  • Save thbishop/779997 to your computer and use it in GitHub Desktop.
Save thbishop/779997 to your computer and use it in GitHub Desktop.
provides tab completion for boom (bash)
_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