5fcb6e1263e9fa7938e4ebfc03bf44aa624a5d7b

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #1988 from jwarwick/mix

Added autocompletion support for Elixir mix command

Diff

 1diff --git a/plugins/mix/_mix b/plugins/mix/_mix
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..602f5ffa0a94a351c7a2a65d2a6720df59e6b1e7
 4--- /dev/null
 5+++ b/plugins/mix/_mix
 6@@ -0,0 +1,63 @@
 7+#compdef mix 
 8+#autoload
 9+
10+# Elixir mix zsh completion
11+
12+local -a _1st_arguments
13+_1st_arguments=(
14+    'archive:Archive this project into a .ez file'
15+    'clean:Clean generated application files'
16+    'compile:Compile source files'
17+    'deps:List dependencies and their status'
18+    "deps.clean:Remove dependencies' files"
19+    'deps.compile:Compile dependencies'
20+    'deps.get:Get all out of date dependencies'
21+    'deps.unlock:Unlock the given dependencies'
22+    'deps.update:Update dependencies'
23+    'do:Executes the commands separated by comma'
24+    'escriptize:Generates an escript for the project'
25+    'help:Print help information for tasks'
26+    'local:List local tasks'
27+    'local.install:Install a task or an archive locally'
28+    'local.rebar:Install rebar locally'
29+    'local.uninstall:Uninstall local tasks or archives'
30+    'new:Creates a new Elixir project'
31+    'run:Run the given file or expression'
32+    "test:Run a project's tests"
33+    '--help:Describe available tasks'
34+    '--version:Prints the Elixir version information'
35+)
36+
37+__task_list ()
38+{
39+    local expl
40+    declare -a tasks
41+
42+    tasks=(archive clean compile deps deps.clean deps.compile deps.get deps.unlock deps.update do escriptize help local local.install local.rebar local.uninstall new run test)
43+
44+    _wanted tasks expl 'help' compadd $tasks
45+}
46+
47+local expl
48+
49+local curcontext="$curcontext" state line
50+typeset -A opt_args
51+
52+_arguments -C \
53+    ':command:->command' \
54+    '*::options:->options'
55+
56+case $state in
57+  (command)
58+      _describe -t commands "mix subcommand" _1st_arguments
59+      return
60+  ;;
61+
62+  (options)
63+    case $line[1] in
64+      (help)
65+         _arguments ':feature:__task_list' 
66+    esac
67+  ;;
68+esac
69+