0e4b638c3f983e3d7f168417bf7db2219cbdf609

Author
Raphaël Brulé <raphaelbrule22@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

Add plugin for rustup completion (#8914)

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/rustup/README.md b/plugins/rustup/README.md
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..ba037f8f6885eb6c96922d2d78a09a2cd883481e
  4--- /dev/null
  5+++ b/plugins/rustup/README.md
  6@@ -0,0 +1,9 @@
  7+# rustup
  8+
  9+This plugin adds completion for [`rustup`](https://rustup.rs/), the toolchain installer for the Rust programming language.
 10+
 11+To use it, add `rustup` to the plugins array in your zshrc file:
 12+
 13+```zsh
 14+plugins=(... rustup)
 15+```
 16diff --git a/plugins/rustup/_rustup b/plugins/rustup/_rustup
 17new file mode 100644
 18index 0000000000000000000000000000000000000000..dab33533a559ce6813bea10018a39389591ccfd0
 19--- /dev/null
 20+++ b/plugins/rustup/_rustup
 21@@ -0,0 +1,1143 @@
 22+#compdef rustup
 23+
 24+autoload -U is-at-least
 25+
 26+_rustup() {
 27+    typeset -A opt_args
 28+    typeset -a _arguments_options
 29+    local ret=1
 30+
 31+    if is-at-least 5.2; then
 32+        _arguments_options=(-s -S -C)
 33+    else
 34+        _arguments_options=(-s -C)
 35+    fi
 36+
 37+    local context curcontext="$curcontext" state line
 38+    _arguments "${_arguments_options[@]}" \
 39+'-v[Enable verbose output]' \
 40+'--verbose[Enable verbose output]' \
 41+'(-v --verbose)-q[Disable progress output]' \
 42+'(-v --verbose)--quiet[Disable progress output]' \
 43+'-h[Prints help information]' \
 44+'--help[Prints help information]' \
 45+'-V[Prints version information]' \
 46+'--version[Prints version information]' \
 47+'::+toolchain -- release channel (e.g. +stable) or custom toolchain to set override:_files' \
 48+":: :_rustup_commands" \
 49+"*::: :->rustup" \
 50+&& ret=0
 51+    case $state in
 52+    (rustup)
 53+        words=($line[2] "${words[@]}")
 54+        (( CURRENT += 1 ))
 55+        curcontext="${curcontext%:*:*}:rustup-command-$line[2]:"
 56+        case $line[2] in
 57+            (dump-testament)
 58+_arguments "${_arguments_options[@]}" \
 59+'-h[Prints help information]' \
 60+'--help[Prints help information]' \
 61+'-V[Prints version information]' \
 62+'--version[Prints version information]' \
 63+&& ret=0
 64+;;
 65+(show)
 66+_arguments "${_arguments_options[@]}" \
 67+'-h[Prints help information]' \
 68+'--help[Prints help information]' \
 69+'-V[Prints version information]' \
 70+'--version[Prints version information]' \
 71+":: :_rustup__show_commands" \
 72+"*::: :->show" \
 73+&& ret=0
 74+case $state in
 75+    (show)
 76+        words=($line[1] "${words[@]}")
 77+        (( CURRENT += 1 ))
 78+        curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:"
 79+        case $line[1] in
 80+            (active-toolchain)
 81+_arguments "${_arguments_options[@]}" \
 82+'-h[Prints help information]' \
 83+'--help[Prints help information]' \
 84+'-V[Prints version information]' \
 85+'--version[Prints version information]' \
 86+&& ret=0
 87+;;
 88+(home)
 89+_arguments "${_arguments_options[@]}" \
 90+'-h[Prints help information]' \
 91+'--help[Prints help information]' \
 92+'-V[Prints version information]' \
 93+'--version[Prints version information]' \
 94+&& ret=0
 95+;;
 96+(profile)
 97+_arguments "${_arguments_options[@]}" \
 98+'-h[Prints help information]' \
 99+'--help[Prints help information]' \
100+'-V[Prints version information]' \
101+'--version[Prints version information]' \
102+&& ret=0
103+;;
104+(keys)
105+_arguments "${_arguments_options[@]}" \
106+'-h[Prints help information]' \
107+'--help[Prints help information]' \
108+'-V[Prints version information]' \
109+'--version[Prints version information]' \
110+&& ret=0
111+;;
112+(help)
113+_arguments "${_arguments_options[@]}" \
114+'-h[Prints help information]' \
115+'--help[Prints help information]' \
116+'-V[Prints version information]' \
117+'--version[Prints version information]' \
118+&& ret=0
119+;;
120+        esac