Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created September 1, 2012 17:11
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 podhmo/3580622 to your computer and use it in GitHub Desktop.
Save podhmo/3580622 to your computer and use it in GitHub Desktop.
_templer(){
local cur opts templates
cur=${COMP_WORDS[COMP_CWORD]}
opts="--help --make-config-file --list --version"
templates="`templer --list | grep ':' | cut -d ':' -f 1`"
if [[ ${cur} == "" ]] ; then
COMPREPLY=($( compgen -W "${opts} ${templates}" -- $cur))
elif [[ ${cur} == -* ]] ; then
COMPREPLY=($( compgen -W "${opts}" -- $cur))
else
COMPREPLY=($( compgen -W "${templates}" -- $cur))
fi
}
complete -F _templer templer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment