915b0e46f275d19e66f8ad7762edc4fcb28967e6

Author
Zaki Manian <zaki@manian.org>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Add completion for cargo, the rust build tool

Copy of the official repository:
https://github.com/rust-lang/cargo/tree/master/src/etc

Signed-off-by: Marc Cornellà <marc.cornella@live.com>

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..17585920252a7919d87a35e18e579460b3f9490a
  4--- /dev/null
  5+++ b/plugins/cargo/_cargo
  6@@ -0,0 +1,497 @@
  7+#compdef cargo
  8+
  9+typeset -A opt_args
 10+autoload -U regexp-replace
 11+
 12+_cargo() {
 13+
 14+_arguments \
 15+    '(- 1 *)'{-h,--help}'[show help message]' \
 16+    '(- 1 *)'--list'[list installed commands]' \
 17+    '(- 1 *)'{-v,--verbose}'[use verbose output]' \
 18+    '(- 1 *)'--color'[colorization option]' \
 19+    '(- 1 *)'{-V,--version}'[show version information]' \
 20+    '1: :_cargo_cmds' \
 21+    '*:: :->args'
 22+
 23+case $state in
 24+    args)
 25+        case $words[1] in
 26+            bench)
 27+                _arguments \
 28+                    '--features=[space separated feature list]' \
 29+                    '--all-features[enable all available features]' \
 30+                    '(-h, --help)'{-h,--help}'[show help message]' \
 31+                    '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
 32+                    "${command_scope_spec[@]}" \
 33+                    '--manifest-path=[path to manifest]: :_files -/' \
 34+                    '--no-default-features[do not build the default features]' \
 35+                    '--no-run[compile but do not run]' \
 36+                    '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
 37+                    '--target=[target triple]' \
 38+                    '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
 39+                    '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
 40+                    '--color=:colorization option:(auto always never)' \
 41+                    ;;
 42+
 43+            build)
 44+                _arguments \
 45+                    '--features=[space separated feature list]' \
 46+                    '--all-features[enable all available features]' \
 47+                    '(-h, --help)'{-h,--help}'[show help message]' \
 48+                    '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
 49+                    "${command_scope_spec[@]}" \
 50+                    '--manifest-path=[path to manifest]: :_files -/' \
 51+                    '--no-default-features[do not build the default features]' \
 52+                    '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
 53+                    '--release=[build in release mode]' \
 54+                    '--target=[target triple]' \
 55+                    '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
 56+                    '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
 57+                    '--color=:colorization option:(auto always never)' \
 58+                    ;;
 59+
 60+            clean)
 61+                _arguments \
 62+                    '(-h, --help)'{-h,--help}'[show help message]' \
 63+                    '--manifest-path=[path to manifest]: :_files -/' \
 64+                    '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
 65+                    '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
 66+                    '--release[whether or not to clean release artifacts]' \
 67+                    '--target=[target triple(default:all)]' \
 68+                    '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
 69+                    '--color=:colorization option:(auto always never)' \
 70+                    ;;
 71+
 72+            doc)
 73+                _arguments \
 74+                    '--features=[space separated feature list]' \
 75+                    '--all-features[enable all available features]' \
 76+                    '(-h, --help)'{-h,--help}'[show help message]' \
 77+                    '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
 78+                    '--manifest-path=[path to manifest]: :_files -/' \
 79+                    '--no-deps[do not build docs for dependencies]' \
 80+                    '--no-default-features[do not build the default features]' \
 81+                    '--open[open docs in browser after the build]' \
 82+                    '(-p, --package)'{-p,--package}'=[package to document]' \
 83+                    '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
 84+                    '--release[build artifacts in release mode, with optimizations]' \
 85+                    '--target=[build for the target triple]' \
 86+                    '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
 87+                    '--color=:colorization option:(auto always never)' \
 88+                    ;;
 89+
 90+            fetch)
 91+                _arguments \
 92+                    '(-h, --help)'{-h,--help}'[show help message]' \
 93+                    '--manifest-path=[path to manifest]: :_files -/' \
 94+                    '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
 95+                    '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
 96+                    '--color=:colorization option:(auto always never)' \
 97+                    ;;
 98+
 99+            generate-lockfile)
100+                _arguments \
101+                    '(-h, --help)'{-h,--help}'[show help message]' \
102+                    '--manifest-path=[path to manifest]: :_files -/' \
103+                    '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
104+                    '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
105+                    '--color=:colorization option:(auto always never)' \
106diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh
107deleted file mode 100644
108index e1dc953ddf27d76a1d93b52cf48c0579fe144c82..0000000000000000000000000000000000000000
109--- a/plugins/cargo/cargo.plugin.zsh
110+++ /dev/null
111@@ -1,22 +0,0 @@
112-function _cargo_commands() {
113-    local ret=1 state
114-    _arguments ':subcommand:->subcommand' && ret=0
115-
116-    case $state in
117-      subcommand)
118-        subcommands=(
119-          "build:Build the current project"
120-          "clean:Clean up after a build"
121-          "help:Help about available commands"
122-          "new:Create a new project"
123-          "test:Run the tests"
124-          "update:Updates list of known packages"
125-          "run:Builds and runs the currecnt project"
126-        )
127-        _describe -t subcommands 'cargo subcommands' subcommands && ret=0
128-    esac
129-
130-    return ret
131-}
132-
133-compdef _cargo_commands cargo