summaryrefslogtreecommitdiff
path: root/plugins/lein
diff options
context:
space:
mode:
authorKozlov Alexander <badryke@gmail.com>2018-11-16 13:38:43 +0300
committerGitHub <noreply@github.com>2018-11-16 13:38:43 +0300
commit8c95c52353118643ac3dbd9b0c185a3129b84bf8 (patch)
treeee7497251b7a541480ae5c6a97b63b14381ed5ee /plugins/lein
parentdd30cf104c9ca42d89d26a134382ca421869ce7e (diff)
parent3d8f2bda599c8c6d160dc448e5ab28aaf2d5e90d (diff)
downloadzsh-8c95c52353118643ac3dbd9b0c185a3129b84bf8.tar.gz
zsh-8c95c52353118643ac3dbd9b0c185a3129b84bf8.tar.bz2
zsh-8c95c52353118643ac3dbd9b0c185a3129b84bf8.zip
Merge branch 'master' into master
Diffstat (limited to 'plugins/lein')
-rw-r--r--plugins/lein/_lein69
-rw-r--r--plugins/lein/lein.plugin.zsh43
2 files changed, 69 insertions, 43 deletions
diff --git a/plugins/lein/_lein b/plugins/lein/_lein
new file mode 100644
index 000000000..9d022e968
--- /dev/null
+++ b/plugins/lein/_lein
@@ -0,0 +1,69 @@
+#compdef lein
+
+# Lein ZSH completion function
+# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
+# and rename it _lein
+
+_lein() {
+ if (( CURRENT > 2 )); then
+ # shift words so _arguments doesn't have to be concerned with second command
+ (( CURRENT-- ))
+ shift words
+ # use _call_function here in case it doesn't exist
+ _call_function 1 _lein_${words[1]}
+ else
+ _values "lein command" \
+ "change[Rewrite project.clj by applying a function.]" \
+ "check[Check syntax and warn on reflection.]" \
+ "classpath[Print the classpath of the current project.]" \
+ "clean[Remove all files from project's target-path.]" \
+ "compile[Compile Clojure source into .class files.]" \
+ "deploy[Build and deploy jar to remote repository.]" \
+ "deps[Download all dependencies.]" \
+ "do[Higher-order task to perform other tasks in succession.]" \
+ "help[Display a list of tasks or help for a given task.]" \
+ "install[Install the current project to the local repository.]" \
+ "jar[Package up all the project's files into a jar file.]" \
+ "javac[Compile Java source files.]" \
+ "new[Generate project scaffolding based on a template.]" \
+ "plugin[DEPRECATED. Please use the :user profile instead.]" \
+ "pom[Write a pom.xml file to disk for Maven interoperability.]" \
+ "release[Perform :release-tasks.]" \
+ "repl[Start a repl session either with the current project or standalone.]" \
+ "retest[Run only the test namespaces which failed last time around.]" \
+ "run[Run a -main function with optional command-line arguments.]" \
+ "search[Search remote maven repositories for matching jars.]" \
+ "show-profiles[List all available profiles or display one if given an argument.]" \
+ "test[Run the project's tests.]" \
+ "trampoline[Run a task without nesting the project's JVM inside Leiningen's.]" \
+ "uberjar[Package up the project files and dependencies into a jar file.]" \
+ "update-in[Perform arbitrary transformations on your project map.]" \
+ "upgrade[Upgrade Leiningen to specified version or latest stable.]" \
+ "vcs[Interact with the version control system.]" \
+ "version[Print version for Leiningen and the current JVM.]" \
+ "with-profile[Apply the given task with the profile(s) specified.]"
+ fi
+}
+
+_lein_plugin() {
+ _values "lein plugin commands" \
+ "install[Download, package, and install plugin jarfile into ~/.lein/plugins]" \
+ "uninstall[Delete the plugin jarfile: \[GROUP/\]ARTIFACT-ID VERSION]"
+}
+
+
+_lein_namespaces() {
+ if [ -f "./project.clj" -a -d "$1" ]; then
+ _values "lein valid namespaces" \
+ $(find "$1" -type f -name "*.clj" -exec awk '/^\(ns */ {gsub("\\)", "", $2); print $2}' '{}' '+')
+ fi
+}
+
+
+_lein_run() {
+ _lein_namespaces "src/"
+}
+
+_lein_test() {
+ _lein_namespaces "test/"
+}
diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh
deleted file mode 100644
index f4e50b447..000000000
--- a/plugins/lein/lein.plugin.zsh
+++ /dev/null
@@ -1,43 +0,0 @@
-function _lein_commands() {
- local ret=1 state
- _arguments ':subcommand:->subcommand' && ret=0
-
- case $state in
- subcommand)
- subcommands=(
- "classpath:print the classpath of the current project"
- "clean:remove compiled files and dependencies from project"
- "compile:ahead-of-time compile the project"
- "deploy:build jar and deploy to remote repository"
- "deps:download and install all dependencies"
- "help:display a list of tasks or help for a given task"
- "install:install the project and its dependencies in your local repository"
- "int:enter an interactive task shell"
- "interactive:enter an interactive task shell"
- "jack-in:jack in to a clojure slime session from emacs."
- "jar:create a jar file containing the compiled .class files"
- "javac:compile java source files"
- "new:create a new project skeleton"
- "plugin:manage user-level plugins"
- "pom:write a pom.xml file to disk for maven interop"
- "repl:start a repl session either with the current project or standalone"
- "retest:run only the test namespaces which failed last time around"
- "run:run the project's -main function"
- "search:search remote maven repositories for matching jars"
- "swank:launch swank server for Emacs to connect"
- "test:run the project's tests"
- "test!:run a project's tests after cleaning and fetching dependencies"
- "trampoline:run a task without nesting the project's JVM inside Leiningen's."
- "uberjar:Create a jar including the contents of each of deps"
- "upgrade:upgrade leiningen to the latest stable release"
- "version:print leiningen's version"
- )
- _describe -t subcommands 'leiningen subcommands' subcommands && ret=0
- ;;
- *) _files
- esac
-
- return ret
-}
-
-compdef _lein_commands lein