Update completion for mix, add completion for mix test, fix completion for mix help

This commit is contained in:
Teja Sophista 2017-04-18 20:20:52 +08:00
parent fa1c720584
commit a63a098071
1 changed files with 142 additions and 50 deletions

192
src/_mix
View File

@ -32,74 +32,89 @@
#
# Completion script for Elixir Mix
#
# Last updated: 23.01.2016
# Last updated: 18.04.2017
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Han Ngo (https://github.com/tieubao)
# * Teja Sophista (https://github.com/tejanium)
#
# ------------------------------------------------------------------------------
local -a _1st_arguments
_1st_arguments=(
'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'
'app.start:Starts all registered apps'
'app.tree:Prints the application tree'
'archive:Lists installed archives'
'archive.build:Archives this project into a .ez file'
'archive.install:Installs an archive locally'
'archive.uninstall:Uninstalls archives'
'clean:Deletes generated application files'
'cmd:Executes the given command'
'compile:Compile source files'
'compile.protocols:Consolidates all protocols in all paths'
'deps:List dependencies and their status'
"deps.clean:Remove the given dependencies' files"
'deps.compile:Compile dependencies'
'deps.get:Get all out of date dependencies'
'deps.unlock:Unlock the given dependencies'
'deps.update:Update the given dependencies'
'compile:Compiles source files'
'deps:Lists dependencies and their status'
"deps.clean:Deletes the given dependencies' files"
'deps.compile:Compiles dependencies'
'deps.get:Gets all out of date dependencies'
'deps.tree:Prints the dependency tree'
'deps.unlock:Unlocks the given dependencies'
'deps.update:Updates the given dependencies'
'do:Executes the tasks separated by comma'
'ecto.create:Create the storage for the repo'
'ecto.drop:Drop the storage for the repo'
'ecto.gen.migration:Generate a new migration for the repo'
'ecto.gen.repo:Generate a new repository'
'ecto.migrate:Run migrations up on a repo'
'ecto.rollback:Rollback migrations from a repo'
'ecto:Prints Ecto help information'
'ecto.create:Creates the repository storage'
'ecto.drop:Drops the repository storage'
'ecto.dump:Dumps the repository database structure'
'ecto.gen.migration:Generates a new migration for the repo'
'ecto.gen.repo:Generates a new repository'
'ecto.load:Loads previously dumped database structure'
'ecto.migrate:Runs the repository migrations'
'ecto.migrations:Displays the repository migration status'
'ecto.rollback:Rolls back the repository migrations'
'escript:Lists installed escripts'
'escript.build:Builds an escript for the project'
'gettext.extract:Get text extract'
'gettext.merge:Get text merge'
'help:Print help information for tasks'
'hex:Print hex help information'
'escript.install:Installs an escript locally'
'escript.uninstall:Uninstalls escripts'
'gettext.extract:Extracts translations from source code'
'gettext.merge:Merge template files into translation files'
'help:Prints help information for tasks'
'hex:Prints Hex help information'
'hex.build:Builds a new package version locally'
'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.registry:Hex registry tasks'
'hex.search:Search for package names'
'hex.user:Hex user tasks'
'hex.config:Reads, updates or deletes Hex config'
'hex.docs:Fetch or open documentation of a package'
'hex.info:Prints Hex information'
'hex.key:Manages Hex API key'
'hex.outdated:Shows outdated Hex deps for the current project'
'hex.owner:Manages Hex package ownership'
'hex.public_keys:Manages Hex public keys'
'hex.publish:Publishes a new package version'
'hex.retire:Retires a package version'
'hex.search:Searches for package names'
'hex.user:Registers or manages Hex user'
'loadconfig:Loads and persists the given configuration'
'local:List local tasks'
'local.hex:Install hex locally'
'local.public_keys:Public keys'
'local.rebar:Install rebar locally'
'new:Create a new Elixir project'
'phoenix.digest:Digests and compress static files'
'phoenix.gen.channel:Generates a Phoenix channel'
'local:Lists local tasks'
'local.hex:Installs Hex locally'
'local.public_keys:Manages public keys'
'local.rebar:Installs Rebar locally'
'new:Creates a new Elixir project'
'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'
'phoenix.new:Create a new Phoenix application'
'phoenix.routes:Prints all routes'
'phoenix.server:Starts applications and their servers'
'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.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.routes:Prints all routes'
'phx.server:Starts applications and their servers'
'profile.fprof:Profiles the given file or expression with fprof'
'run:Run the given file or expression'
"test:Run a project's tests"
'run:Runs the given file or expression'
"test:Runs a project's tests"
'xref:Performs cross reference checks'
'--help:Describe available tasks'
'--version:Prints the Elixir version information'
)
@ -109,7 +124,78 @@ __task_list ()
local expl
declare -a tasks
tasks=$(mix --help | grep -v "default task" | awk '{print $2}')
tasks=(
'app.start'
'app.tree'
'archive'
'archive.build'
'archive.install'
'archive.uninstall'
'clean'
'cmd'
'compile'
'deps'
'deps.clean'
'deps.compile'
'deps.get'
'deps.tree'
'deps.unlock'
'deps.update'
'do'
'ecto'
'ecto.create'
'ecto.drop'
'ecto.dump'
'ecto.gen.migration'
'ecto.gen.repo'
'ecto.load'
'ecto.migrate'
'ecto.migrations'
'ecto.rollback'
'escript'
'escript.build'
'escript.install'
'escript.uninstall'
'gettext.extract'
'gettext.merge'
'help'
'hex'
'hex.build'
'hex.config'
'hex.docs'
'hex.info'
'hex.key'
'hex.outdated'
'hex.owner'
'hex.public_keys'
'hex.publish'
'hex.retire'
'hex.search'
'hex.user'
'loadconfig'
'local'
'local.hex'
'local.public_keys'
'local.rebar'
'new'
'phoenix.gen.html'
'phoenix.server'
'phx.digest'
'phx.digest.clean'
'phx.gen.channel'
'phx.gen.context'
'phx.gen.html'
'phx.gen.json'
'phx.gen.presence'
'phx.gen.schema'
'phx.gen.secret'
'phx.routes'
'phx.server'
'profile.fprof'
'run'
'test'
'xref'
)
_wanted tasks expl 'help' compadd $tasks
}
@ -133,6 +219,12 @@ case $state in
case $line[1] in
(help)
_arguments ':feature:__task_list'
return
;;
(test)
_arguments ':PATH:_files'
return
;;
esac
;;
esac