Skip to content

Instantly share code, notes, and snippets.

@hamann
Created April 2, 2015 15:05
Show Gist options
  • Select an option

  • Save hamann/39371c46806e14ab3853 to your computer and use it in GitHub Desktop.

Select an option

Save hamann/39371c46806e14ab3853 to your computer and use it in GitHub Desktop.

Revisions

  1. hamann created this gist Apr 2, 2015.
    88 changes: 88 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,88 @@
    #compdef mix
    #autoload

    # Elixir mix zsh completion

    local -a _1st_arguments
    _1st_arguments=(
    'archive:Archive this project into a .ez file'
    'archive.build:Archive this project into a .ez file'
    'archive.install:Install an archive locally'
    'archive.uninstall:Uninstall archives'
    'clean:Clean generated application files'
    'compile:Compile source files'
    'deps:List dependencies and their status'
    "deps.clean:Remove dependencies' files"
    'deps.compile:Compile dependencies'
    'deps.get:Get all out of date dependencies'
    'deps.unlock:Unlock the given dependencies'
    'deps.update:Update dependencies'
    'do:Executes the commands 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'
    'escriptize:Generates an escript for the project'
    'help:Print help information for tasks'
    '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.owner:Hex package ownership tasks'
    'hex.publish:Publish a new package version'
    'hex.search:Search for package names'
    'hex.user:Hex user tasks'
    'local:List local tasks'
    'local.install:Install a task or an archive locally'
    'local.rebar:Install rebar locally'
    'local.uninstall:Uninstall local tasks or archives'
    'local.hex:Install Hex locally'
    'new:Creates a new Elixir project'
    'phoenix.gen.resource:Generates resource files'
    'phoenix.new:Create a new Phoenix application'
    'phoenix.routes:Prints all routes'
    'phoenix.server:Starts applications and their servers'
    'release:Build a release for the current mix application.'
    'release.clean:Clean up any release-related files.'
    'release.plugins:View information about active release plugins'
    '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

    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)

    _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)
    _arguments ':feature:__task_list'
    esac
    ;;
    esac