]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/lein/_lein
9d022e9689f00e02967ba6a6150465b67d142fdc
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / lein / _lein
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       "change[Rewrite project.clj by applying a function.]" \
17       "check[Check syntax and warn on reflection.]" \
18       "classpath[Print the classpath of the current project.]" \
19       "clean[Remove all files from project's target-path.]" \
20       "compile[Compile Clojure source into .class files.]" \
21       "deploy[Build and deploy jar to remote repository.]" \
22       "deps[Download all dependencies.]" \
23       "do[Higher-order task to perform other tasks in succession.]" \
24       "help[Display a list of tasks or help for a given task.]" \
25       "install[Install the current project to the local repository.]" \
26       "jar[Package up all the project's files into a jar file.]" \
27       "javac[Compile Java source files.]" \
28       "new[Generate project scaffolding based on a template.]" \
29       "plugin[DEPRECATED. Please use the :user profile instead.]" \
30       "pom[Write a pom.xml file to disk for Maven interoperability.]" \
31       "release[Perform :release-tasks.]" \
32       "repl[Start a repl session either with the current project or standalone.]" \
33       "retest[Run only the test namespaces which failed last time around.]" \
34       "run[Run a -main function with optional command-line arguments.]" \
35       "search[Search remote maven repositories for matching jars.]" \
36       "show-profiles[List all available profiles or display one if given an argument.]" \
37       "test[Run the project's tests.]" \
38       "trampoline[Run a task without nesting the project's JVM inside Leiningen's.]" \
39       "uberjar[Package up the project files and dependencies into a jar file.]" \
40       "update-in[Perform arbitrary transformations on your project map.]" \
41       "upgrade[Upgrade Leiningen to specified version or latest stable.]" \
42       "vcs[Interact with the version control system.]" \
43       "version[Print version for Leiningen and the current JVM.]" \
44       "with-profile[Apply the given task with the profile(s) specified.]"
45   fi
46 }
47
48 _lein_plugin() {
49   _values "lein plugin commands" \
50     "install[Download, package, and install plugin jarfile into ~/.lein/plugins]" \
51     "uninstall[Delete the plugin jarfile: \[GROUP/\]ARTIFACT-ID VERSION]"
52 }
53
54
55 _lein_namespaces() {
56   if [ -f "./project.clj" -a -d "$1" ]; then
57     _values "lein valid namespaces" \
58       $(find "$1" -type f -name "*.clj" -exec awk '/^\(ns */ {gsub("\\)", "", $2); print $2}' '{}' '+')
59   fi
60 }
61
62
63 _lein_run() {
64   _lein_namespaces "src/"
65 }
66
67 _lein_test() {
68   _lein_namespaces "test/"
69 }