Skip to content
This repository
Newer
Older
100644 34 lines (32 sloc) 1.27 kb
3ab3935d » danlarkin
2009-12-11 first shot at bash completion for lein shell script
1 _lein_completion() {
2 local cur prev tasks
3 COMPREPLY=()
4 cur="${COMP_WORDS[COMP_CWORD]}"
5 prev="${COMP_WORDS[COMP_CWORD-1]}"
31e5c6fe »
2011-01-15 Update bash completion with latest task list.
6 tasks="classpath clean compile deploy deps help install interactive jar javac new plugin pom repl run swank test test! uberjar version"
3ab3935d » danlarkin
2009-12-11 first shot at bash completion for lein shell script
7
8 case "${prev}" in
31e5c6fe »
2011-01-15 Update bash completion with latest task list.
9 classpath | clean | compile | deploy | deps | install | interactive | jar | javac | new | plugin | pom | repl | swank | uberjar | version)
3ab3935d » danlarkin
2009-12-11 first shot at bash completion for lein shell script
10 COMPREPLY=()
11 ;;
12 help)
13 # Show tasks again, but only once; don't infinitely recurse
14 local prev2="${COMP_WORDS[COMP_CWORD-2]}"
15 if [ "$prev2" == "help" ]; then
16 COMPREPLY=()
17 else
18 COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
19 fi
20 ;;
31e5c6fe »
2011-01-15 Update bash completion with latest task list.
21 run | test | test!)
3ab3935d » danlarkin
2009-12-11 first shot at bash completion for lein shell script
22 # list project's test namespaces:
23 local namespaces=$(find test/ -type f -name "*.clj" -exec grep -E \
24 '^\(ns[[:space:]]+\w+' '{}' ';' | sed -n 's/(ns[ ]*//p')
25 COMPREPLY=( $(compgen -W "${namespaces}" -- ${cur}) )
26 ;;
27 lein)
28 COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
29 ;;
30 esac
31
32 return 0
33 }
34 complete -F _lein_completion lein
Something went wrong with that request. Please try again.