Skip to content

Instantly share code, notes, and snippets.

@stantont
Forked from timcharper/lein-completion.bash
Created April 23, 2010 11:11
Show Gist options
  • Select an option

  • Save stantont/376442 to your computer and use it in GitHub Desktop.

Select an option

Save stantont/376442 to your computer and use it in GitHub Desktop.
_lein_test()
{
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
if [ -d test ]; then
COMPREPLY=($(compgen -W '$(cd test; find * -name \*.clj | sed "s/.clj\$//" | sed "s/_/-/g" | sed "s|/|.|g")' -- $curw));
return 0
fi
}
_lein()
{
if [ $COMP_CWORD == 1 ]; then
curw=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "repl pom help install jar test deps uberjar clean compile version swank new" -- $curw) )
return 0
else
case ${COMP_WORDS[1]} in
test) _lein_test ;;
esac
fi
}
complete -F _lein -o default lein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment