Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (36 sloc) 1.469 kb
3ab3935 Dan Larkin first shot at bash completion for lein shell script
danlarkin authored
1 _lein_completion() {
2 local cur prev tasks
3 COMPREPLY=()
4 cur="${COMP_WORDS[COMP_CWORD]}"
5 prev="${COMP_WORDS[COMP_CWORD-1]}"
d255672 Phil Hagelberg Update news and bash/zsh completion scripts. Fixes #437.
authored
6 tasks="check classpath clean compile deploy deps help install jar javac new pom repl retest run search swank test trampoline uberjar upgrade version with-profile"
3ab3935 Dan Larkin first shot at bash completion for lein shell script
danlarkin authored
7
8 case "${prev}" in
d255672 Phil Hagelberg Update news and bash/zsh completion scripts. Fixes #437.
authored
9 check | classpath | clean | deploy | deps | install | jar | javac | new | pom | repl | swank | uberjar | version)
3ab3935 Dan Larkin first shot at bash completion for lein shell script
danlarkin authored
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 ;;
d255672 Phil Hagelberg Update news and bash/zsh completion scripts. Fixes #437.
authored
21 test | retest )
3ab3935 Dan Larkin first shot at bash completion for lein shell script
danlarkin authored
22 # list project's test namespaces:
edb1745 Jürgen Hötzel Improve namespace completion performance
juergenhoetzel authored
23 local namespaces=$(find test/ -type f -name "*.clj" -exec sed -n 's/^(ns[ ]*//p' '{}' '+')
3ab3935 Dan Larkin first shot at bash completion for lein shell script
danlarkin authored
24 COMPREPLY=( $(compgen -W "${namespaces}" -- ${cur}) )
25 ;;
d255672 Phil Hagelberg Update news and bash/zsh completion scripts. Fixes #437.
authored
26 run | compile)
27 # list project's src namespaces:
edb1745 Jürgen Hötzel Improve namespace completion performance
juergenhoetzel authored
28 local namespaces=$(find src/ -type f -name "*.clj" -exec sed -n 's/^(ns[ ]*//p' '{}' '+')
d255672 Phil Hagelberg Update news and bash/zsh completion scripts. Fixes #437.
authored
29 COMPREPLY=( $(compgen -W "${namespaces}" -- ${cur}) )
30 ;;
3ab3935 Dan Larkin first shot at bash completion for lein shell script
danlarkin authored
31 lein)
32 COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
33 ;;
34 esac
35
36 return 0
37 }
38 complete -F _lein_completion lein
Something went wrong with that request. Please try again.