Skip to content

Instantly share code, notes, and snippets.

@danielhauck
Created July 8, 2015 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielhauck/97f799d0316174b40a01 to your computer and use it in GitHub Desktop.
Save danielhauck/97f799d0316174b40a01 to your computer and use it in GitHub Desktop.
bash completion for markusblaschke/clitools
## add me to /etc/bash_completion.d/
## cp FILE /etc/bash_completion.d/
## reload completion
## exec bash
_available_commands()
{
ct list --raw | awk '{print $1}'
}
_clitools()
{
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]
then
COMPREPLY=( $( compgen -W '$(_available_commands)' -- $cur) )
fi
}
complete -F _clitools ct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment