Diff
1diff --git a/plugins/lein/_lein b/plugins/lein/_lein
2new file mode 100644
3index 0000000000000000000000000000000000000000..9d022e9689f00e02967ba6a6150465b67d142fdc
4--- /dev/null
5+++ b/plugins/lein/_lein
6@@ -0,0 +1,69 @@
7+#compdef lein
8+
9+# Lein ZSH completion function
10+# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
11+# and rename it _lein
12+
13+_lein() {
14+ if (( CURRENT > 2 )); then
15+ # shift words so _arguments doesn't have to be concerned with second command
16+ (( CURRENT-- ))
17+ shift words
18+ # use _call_function here in case it doesn't exist
19+ _call_function 1 _lein_${words[1]}
20+ else
21+ _values "lein command" \
22+ "change[Rewrite project.clj by applying a function.]" \
23+ "check[Check syntax and warn on reflection.]" \
24+ "classpath[Print the classpath of the current project.]" \
25+ "clean[Remove all files from project's target-path.]" \
26+ "compile[Compile Clojure source into .class files.]" \
27+ "deploy[Build and deploy jar to remote repository.]" \
28+ "deps[Download all dependencies.]" \
29+ "do[Higher-order task to perform other tasks in succession.]" \
30+ "help[Display a list of tasks or help for a given task.]" \
31+ "install[Install the current project to the local repository.]" \
32+ "jar[Package up all the project's files into a jar file.]" \
33+ "javac[Compile Java source files.]" \
34+ "new[Generate project scaffolding based on a template.]" \
35+ "plugin[DEPRECATED. Please use the :user profile instead.]" \
36+ "pom[Write a pom.xml file to disk for Maven interoperability.]" \
37+ "release[Perform :release-tasks.]" \
38+ "repl[Start a repl session either with the current project or standalone.]" \
39+ "retest[Run only the test namespaces which failed last time around.]" \
40+ "run[Run a -main function with optional command-line arguments.]" \
41+ "search[Search remote maven repositories for matching jars.]" \
42+ "show-profiles[List all available profiles or display one if given an argument.]" \
43+ "test[Run the project's tests.]" \
44+ "trampoline[Run a task without nesting the project's JVM inside Leiningen's.]" \
45+ "uberjar[Package up the project files and dependencies into a jar file.]" \
46+ "update-in[Perform arbitrary transformations on your project map.]" \
47+ "upgrade[Upgrade Leiningen to specified version or latest stable.]" \
48+ "vcs[Interact with the version control system.]" \
49+ "version[Print version for Leiningen and the current JVM.]" \
50+ "with-profile[Apply the given task with the profile(s) specified.]"
51+ fi
52+}
53+
54+_lein_plugin() {
55+ _values "lein plugin commands" \
56+ "install[Download, package, and install plugin jarfile into ~/.lein/plugins]" \
57+ "uninstall[Delete the plugin jarfile: \[GROUP/\]ARTIFACT-ID VERSION]"
58+}
59+
60+
61+_lein_namespaces() {
62+ if [ -f "./project.clj" -a -d "$1" ]; then
63+ _values "lein valid namespaces" \
64+ $(find "$1" -type f -name "*.clj" -exec awk '/^\(ns */ {gsub("\\)", "", $2); print $2}' '{}' '+')
65+ fi
66+}
67+
68+
69+_lein_run() {
70+ _lein_namespaces "src/"
71+}
72+
73+_lein_test() {
74+ _lein_namespaces "test/"
75+}
76diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh
77deleted file mode 100644
78index f4e50b44794530ad788f65d8bca9146828d6e92c..0000000000000000000000000000000000000000
79--- a/plugins/lein/lein.plugin.zsh
80+++ /dev/null
81@@ -1,43 +0,0 @@
82-function _lein_commands() {
83- local ret=1 state
84- _arguments ':subcommand:->subcommand' && ret=0
85-
86- case $state in
87- subcommand)
88- subcommands=(
89- "classpath:print the classpath of the current project"
90- "clean:remove compiled files and dependencies from project"
91- "compile:ahead-of-time compile the project"
92- "deploy:build jar and deploy to remote repository"
93- "deps:download and install all dependencies"
94- "help:display a list of tasks or help for a given task"
95- "install:install the project and its dependencies in your local repository"
96- "int:enter an interactive task shell"
97- "interactive:enter an interactive task shell"
98- "jack-in:jack in to a clojure slime session from emacs."
99- "jar:create a jar file containing the compiled .class files"
100- "javac:compile java source files"
101- "new:create a new project skeleton"
102- "plugin:manage user-level plugins"
103- "pom:write a pom.xml file to disk for maven interop"
104- "repl:start a repl session either with the current project or standalone"
105- "retest:run only the test namespaces which failed last time around"
106- "run:run the project's -main function"
107- "search:search remote maven repositories for matching jars"
108- "swank:launch swank server for Emacs to connect"
109- "test:run the project's tests"
110- "test!:run a project's tests after cleaning and fetching dependencies"
111- "trampoline:run a task without nesting the project's JVM inside Leiningen's."
112- "uberjar:Create a jar including the contents of each of deps"
113- "upgrade:upgrade leiningen to the latest stable release"
114- "version:print leiningen's version"
115- )
116- _describe -t subcommands 'leiningen subcommands' subcommands && ret=0
117- ;;
118- *) _files
119- esac
120-
121- return ret
122-}
123-
124-compdef _lein_commands lein