08d086a09c0181b733a9f5565fc242ca148fd80a

Author
Patrick Fitzgerald <auskast03@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(volta): add volta plugin (#10441)

For Volta JavaScript toolchain
https://github.com/volta-cli/volta

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/volta/README.md b/plugins/volta/README.md
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..d5972d56c5f8f59dcee4f8114405e91d142b7a97
  4--- /dev/null
  5+++ b/plugins/volta/README.md
  6@@ -0,0 +1,11 @@
  7+# Volta
  8+
  9+This plugin provides completion for [Volta](https://volta.sh/).
 10+
 11+To use it add volta to the plugins array in your zshrc file.
 12+
 13+```bash
 14+plugins=(... volta)
 15+```
 16+
 17+This plugin installs no aliases.
 18diff --git a/plugins/volta/_volta b/plugins/volta/_volta
 19new file mode 100644
 20index 0000000000000000000000000000000000000000..295b80362c8da956f50db47d4047b6084b2491e8
 21--- /dev/null
 22+++ b/plugins/volta/_volta
 23@@ -0,0 +1,298 @@
 24+#compdef volta
 25+
 26+autoload -U is-at-least
 27+
 28+_volta() {
 29+    typeset -A opt_args
 30+    typeset -a _arguments_options
 31+    local ret=1
 32+
 33+    if is-at-least 5.2; then
 34+        _arguments_options=(-s -S -C)
 35+    else
 36+        _arguments_options=(-s -C)
 37+    fi
 38+
 39+    local context curcontext="$curcontext" state line
 40+    _arguments "${_arguments_options[@]}" \
 41+'--verbose[Enables verbose diagnostics]' \
 42+'(--verbose)--quiet[Prevents unnecessary output]' \
 43+'-v[Prints the current version of Volta]' \
 44+'--version[Prints the current version of Volta]' \
 45+'-h[Prints help information]' \
 46+'--help[Prints help information]' \
 47+":: :_volta_commands" \
 48+"*::: :->Volta" \
 49+&& ret=0
 50+    case $state in
 51+    (Volta)
 52+        words=($line[1] "${words[@]}")
 53+        (( CURRENT += 1 ))
 54+        curcontext="${curcontext%:*:*}:volta-command-$line[1]:"
 55+        case $line[1] in
 56+            (fetch)
 57+_arguments "${_arguments_options[@]}" \
 58+'-h[Prints help information]' \
 59+'--help[Prints help information]' \
 60+'-V[Prints version information]' \
 61+'--version[Prints version information]' \
 62+'--verbose[Enables verbose diagnostics]' \
 63+'(--verbose)--quiet[Prevents unnecessary output]' \
 64+':tool[@version] -- Tools to fetch, like `node`, `yarn@latest` or `your-package@^14.4.3`.:_files' \
 65+&& ret=0
 66+;;
 67+(install)
 68+_arguments "${_arguments_options[@]}" \
 69+'-h[Prints help information]' \
 70+'--help[Prints help information]' \
 71+'-V[Prints version information]' \
 72+'--version[Prints version information]' \
 73+'--verbose[Enables verbose diagnostics]' \
 74+'(--verbose)--quiet[Prevents unnecessary output]' \
 75+':tool[@version] -- Tools to install, like `node`, `yarn@latest` or `your-package@^14.4.3`.:_files' \
 76+&& ret=0
 77+;;
 78+(uninstall)
 79+_arguments "${_arguments_options[@]}" \
 80+'-h[Prints help information]' \
 81+'--help[Prints help information]' \
 82+'-V[Prints version information]' \
 83+'--version[Prints version information]' \
 84+'--verbose[Enables verbose diagnostics]' \
 85+'(--verbose)--quiet[Prevents unnecessary output]' \
 86+':tool -- The tool to uninstall, e.g. `node`, `npm`, `yarn`, or <package>:_files' \
 87+&& ret=0
 88+;;
 89+(pin)
 90+_arguments "${_arguments_options[@]}" \
 91+'-h[Prints help information]' \
 92+'--help[Prints help information]' \
 93+'-V[Prints version information]' \
 94+'--version[Prints version information]' \
 95+'--verbose[Enables verbose diagnostics]' \
 96+'(--verbose)--quiet[Prevents unnecessary output]' \
 97+':tool[@version] -- Tools to pin, like `node@lts` or `yarn@^1.14`.:_files' \
 98+&& ret=0
 99+;;
100+(ls)
101+_arguments "${_arguments_options[@]}" \
102+'--format=[Specify the output format]: :(human plain)' \
103+'(-d --default)-c[Show the currently-active tool(s)]' \
104+'(-d --default)--current[Show the currently-active tool(s)]' \
105+'(-c --current)-d[Show your default tool(s).]' \
106+'(-c --current)--default[Show your default tool(s).]' \
107+'-h[Prints help information]' \
108+'--help[Prints help information]' \
109+'-V[Prints version information]' \
110+'--version[Prints version information]' \
111+'--verbose[Enables verbose diagnostics]' \
112+'(--verbose)--quiet[Prevents unnecessary output]' \
113+'::tool -- The tool to lookup - `all`, `node`, `yarn`, or the name of a package or binary.:_files' \
114+&& ret=0
115+;;
116+(list)
117+_arguments "${_arguments_options[@]}" \
118+'--format=[Specify the output format]: :(human plain)' \
119+'(-d --default)-c[Show the currently-active tool(s)]' \
120+'(-d --default)--current[Show the currently-active tool(s)]' \
121+'(-c --current)-d[Show your default tool(s).]' \
122+'(-c --current)--default[Show your default tool(s).]' \