_mix 4.89 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
    'deps.update:Update the given dependencies'
    'do:Executes the tasks separated by comma'
24
25
26
27
28
29
30
31
32
    'ecto.create:Create Ecto database'
    'ecto.drop:Drop the storage for the given repository'
    'ecto.dump:Dumps the current environment’s database structure'
    'ecto.gen.migration:Generates a migration'
    'ecto.gen.repo:Generates a new repository'
    'ecto.load:Loads the current environment’s database structure'
    'ecto.migrate:Runs Ecto migration'
    'ecto.migrations:Displays the up / down migration status'
    'ecto.rollback:Reverts applied migrations'
33
    'escript.build:Builds an escript for the project'
34
    'help:Print help information for tasks'
35
36
37
38
39
40
41
42
43
44
45
    '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'
46
    'local:List local tasks'
47
    'local.hex:Install hex locally'
48
49
    'local.phoenix:Updates Phoenix locally'
    'local.phx:Updates the Phoenix project generator locally'
50
    'local.rebar:Install rebar locally'
51
    'new:Create a new Elixir project'
52
53
54
55
56
57
    'phoenix.digest:Digests and compress static files'
    'phoenix.gen.channel:Generates a Phoenix channel'
    'phoenix.gen.html:Generates controller, model and views for an HTML based resource'
    'phoenix.gen.json:Generates a controller and model for a JSON based resource'
    'phoenix.gen.model:Generates an Ecto model'
    'phoenix.gen.secret:Generates a secret'
58
    'phoenix.new:Creates a new Phoenix v1.2.1 application'
59
60
    'phoenix.routes:Prints all routes'
    'phoenix.server:Starts applications and their servers'
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    'phx.digest:Digests and compresses static files'
    'phx.digest.clean:Removes old versions of static assets.'
    'phx.gen.channel:Generates a Phoenix channel'
    'phx.gen.context:Generates a context with functions around an Ecto schema'
    'phx.gen.embedded:Generates an embedded Ecto schema file'
    'phx.gen.html:Generates controller, views, and context for an HTML resource'
    'phx.gen.json:Generates controller, views, and context for a JSON resource'
    'phx.gen.presence:Generates a Presence tracker'
    'phx.gen.schema:Generates an Ecto schema and migration file'
    'phx.gen.secret:Generates a secret'
    'phx.new:Creates a new Phoenix v1.3.0 application'
    'phx.new.ecto:Creates a new Ecto project within an umbrella project'
    'phx.new.web:Creates a new Phoenix web project within an umbrella project'
    'phx.routes:Prints all routes'
    'phx.server:Starts applications and their servers'
76
77
78
79
80
81
82
83
84
85
86
    '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

87
    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 phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

    _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)
110
         _arguments ':feature:__task_list'
Tony Han's avatar
Tony Han committed
111
112
113
114
         ;;
      (test)
         _files
         ;;
115
116
117
      (run)
         _files
         ;;
118
119
120
    esac
  ;;
esac