_mix 2.53 KB
Newer Older
1
#compdef mix
2
3
4
5
6
7
#autoload

# Elixir mix zsh completion

local -a _1st_arguments
_1st_arguments=(
8
9
10
11
12
13
14
    'app.start:Start all registered apps'
    'archive:List all archives'
    'archive.build:Archive this project into a .ez file'
    'archive.install:Install an archive locally'
    'archive.uninstall:Uninstall archives'
    'clean:Delete generated application files'
    'cmd:Executes the given command'
15
    'compile:Compile source files'
16
    'compile.protocols:Consolidates all protocols in all paths'
17
    'deps:List dependencies and their status'
18
    "deps.clean:Remove the given dependencies' files"
19
20
21
    'deps.compile:Compile dependencies'
    'deps.get:Get all out of date dependencies'
    'deps.unlock:Unlock the given dependencies'
22
23
24
    'deps.update:Update the given dependencies'
    'do:Executes the tasks separated by comma'
    'escript.build:Builds an escript for the project'
25
    'help:Print help information for tasks'
26
27
28
29
30
31
32
33
34
35
36
    'hex:Print hex help information'
    'hex.config:Read or update hex config'
    'hex.docs:Publish docs for package'
    'hex.info:Print hex information'
    'hex.key:Hex API key tasks'
    'hex.outdated:Shows outdated hex deps for the current project'
    'hex.owner:Hex package ownership tasks'
    'hex.publish:Publish a new package version'
    'hex.search:Search for package names'
    'hex.user:Hex user tasks'
    'loadconfig:Loads and persists the given configuration'
37
    'local:List local tasks'
38
    'local.hex:Install hex locally'
39
    'local.rebar:Install rebar locally'
40
    'new:Create a new Elixir project'
41
42
43
44
45
46
47
48
49
50
51
    'run:Run the given file or expression'
    "test:Run a project's tests"
    '--help:Describe available tasks'
    '--version:Prints the Elixir version information'
)

__task_list ()
{
    local expl
    declare -a tasks

52
    tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new run test)
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

    _wanted tasks expl 'help' compadd $tasks
}

local expl

local curcontext="$curcontext" state line
typeset -A opt_args

_arguments -C \
    ':command:->command' \
    '*::options:->options'

case $state in
  (command)
      _describe -t commands "mix subcommand" _1st_arguments
      return
  ;;

  (options)
    case $line[1] in
      (help)
75
         _arguments ':feature:__task_list'
Tony Han's avatar
Tony Han committed
76
77
78
79
         ;;
      (test)
         _files
         ;;
80
81
82
83
    esac
  ;;
esac