Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 70 lines (60 sloc) 2.587 kb
dc04530 @gmwils Add zsh completion for lein
gmwils authored
1 #compdef lein
2
3 # Lein ZSH completion function
4 # Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
5 # and rename it _lein
6
7 _lein() {
8 if (( CURRENT > 2 )); then
9 # shift words so _arguments doesn't have to be concerned with second command
10 (( CURRENT-- ))
11 shift words
12 # use _call_function here in case it doesn't exist
13 _call_function 1 _lein_${words[1]}
14 else
15 _values "lein command" \
16 "classpath[Print the classpath of the current project.]" \
17 "clean[Remove compiled class files and jars from project.]" \
18 "compile[Compile Clojure source into \.class files.]" \
19 "deploy[Build jar and deploy to remote repository.]" \
20 "deps[Download :dependencies and put them in :library-path.]" \
21 "help[Display a list of tasks or help for a given task.]" \
22 "install[Install current project or download specified project.]" \
23 "interactive[Enter an interactive task shell.]" \
24 "jack-in[Jack in to a Clojure SLIME session from Emacs.]" \
25 "jar[Package up all the project's files into a jar file.]" \
26 "javac[Compile Java source files.]" \
27 "new[Create a new project skeleton.]" \
28 "plugin[Manage user-level plugins.]" \
29 "pom[Write a pom.xml file to disk for Maven interop.]" \
30 "repl[Start a repl session either with the current project or standalone.]" \
31 "retest[Run only the test namespaces which failed last time around.]" \
32 "run[Run the project's -main function.]" \
33 "search[Search remote repositories.]" \
34 "swank[Launch swank server for Emacs to connect.]" \
35 "test[Run the project's tests.]" \
36 "test![Run a project's tests after cleaning and fetching dependencies.]" \
37 "trampoline[Run a task without nesting the project's JVM inside Leiningen's.]" \
38 "uberjar[Package up the project files and all dependencies into a jar file.]" \
39 "upgrade[Upgrade Leiningen to the latest stable release.]" \
40 "version[Print version for Leiningen and the current JVM.]"
41 fi
42 }
43
44 _lein_plugin() {
45 _values "lein plugin commands" \
46 "install[Download, package, and install plugin jarfile into ~/.lein/plugins]" \
47 "uninstall[Delete the plugin jarfile: \[GROUP/\]ARTIFACT-ID VERSION]"
48 }
49
50
51 _lein_namespaces() {
52 if [ -d test ]; then
53 _values "lein valid namespaces" $(find $1 -type f -name "*.clj" -exec grep -E \
54 '^\(ns[[:space:]]+\w+' '{}' ';' | awk '/\(ns[ ]*([A-Za-z\.]+)/ {print $2}')
55 fi
56 }
57
58 _lein_run() {
59 _lein_namespaces "src/"
60 }
61
62 _lein_test() {
63 _lein_namespaces "test/"
64 }
65
66 _lein_test!() {
67 _lein_namespaces "test/"
68 }
69
Something went wrong with that request. Please try again.