summaryrefslogtreecommitdiff
path: root/plugins/volta/_volta
blob: 295b80362c8da956f50db47d4047b6084b2491e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#compdef volta

autoload -U is-at-least

_volta() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
'-v[Prints the current version of Volta]' \
'--version[Prints the current version of Volta]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
":: :_volta_commands" \
"*::: :->Volta" \
&& ret=0
    case $state in
    (Volta)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:volta-command-$line[1]:"
        case $line[1] in
            (fetch)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
':tool[@version] -- Tools to fetch, like `node`, `yarn@latest` or `your-package@^14.4.3`.:_files' \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
':tool[@version] -- Tools to install, like `node`, `yarn@latest` or `your-package@^14.4.3`.:_files' \
&& ret=0
;;
(uninstall)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
':tool -- The tool to uninstall, e.g. `node`, `npm`, `yarn`, or <package>:_files' \
&& ret=0
;;
(pin)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
':tool[@version] -- Tools to pin, like `node@lts` or `yarn@^1.14`.:_files' \
&& ret=0
;;
(ls)
_arguments "${_arguments_options[@]}" \
'--format=[Specify the output format]: :(human plain)' \
'(-d --default)-c[Show the currently-active tool(s)]' \
'(-d --default)--current[Show the currently-active tool(s)]' \
'(-c --current)-d[Show your default tool(s).]' \
'(-c --current)--default[Show your default tool(s).]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
'::tool -- The tool to lookup - `all`, `node`, `yarn`, or the name of a package or binary.:_files' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" \
'--format=[Specify the output format]: :(human plain)' \
'(-d --default)-c[Show the currently-active tool(s)]' \
'(-d --default)--current[Show the currently-active tool(s)]' \
'(-c --current)-d[Show your default tool(s).]' \
'(-c --current)--default[Show your default tool(s).]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
'::tool -- The tool to lookup - `all`, `node`, `yarn`, or the name of a package or binary.:_files' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-o+[File to write generated completions to]' \
'--output=[File to write generated completions to]' \
'-f[Write over an existing file, if any.]' \
'--force[Write over an existing file, if any.]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
':shell -- Shell to generate completions for:(zsh bash fish powershell elvish)' \
&& ret=0
;;
(which)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
':binary -- The binary to find, e.g. `node` or `npm`:_files' \
&& ret=0
;;
(use)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
'::anything:_files' \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" \
'--node=[Set the custom Node version]' \
'(--bundled-npm)--npm=[Set the custom npm version]' \
'(--no-yarn)--yarn=[Set the custom Yarn version]' \
'*--env=[Set an environment variable (can be used multiple times)]' \
'(--npm)--bundled-npm[Forces npm to be the version bundled with Node]' \
'(--yarn)--no-yarn[Disables Yarn]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
':command -- The command to run:_files' \
'::args -- Arguments to pass to the command:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'--verbose[Enables verbose diagnostics]' \
'(--verbose)--quiet[Prevents unnecessary output]' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_volta_commands] )) ||
_volta_commands() {
    local commands; commands=(
        "fetch:Fetches a tool to the local machine" \
"install:Installs a tool in your toolchain" \
"uninstall:Uninstalls a tool from your toolchain" \
"pin:Pins your project's runtime or package manager" \
"list:Displays the current toolchain" \
"completions:Generates Volta completions" \
"which:Locates the actual binary that will be called by Volta" \
"use:" \
"setup:Enables Volta for the current user / shell" \
"run:Run a command with custom Node, npm, and/or Yarn versions" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'volta commands' commands "$@"
}
(( $+functions[_volta__completions_commands] )) ||
_volta__completions_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta completions commands' commands "$@"
}
(( $+functions[_volta__fetch_commands] )) ||
_volta__fetch_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta fetch commands' commands "$@"
}
(( $+functions[_volta__help_commands] )) ||
_volta__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta help commands' commands "$@"
}
(( $+functions[_volta__install_commands] )) ||
_volta__install_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta install commands' commands "$@"
}
(( $+functions[_volta__list_commands] )) ||
_volta__list_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta list commands' commands "$@"
}
(( $+functions[_ls_commands] )) ||
_ls_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'ls commands' commands "$@"
}
(( $+functions[_volta__ls_commands] )) ||
_volta__ls_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta ls commands' commands "$@"
}
(( $+functions[_volta__pin_commands] )) ||
_volta__pin_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta pin commands' commands "$@"
}
(( $+functions[_volta__run_commands] )) ||
_volta__run_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta run commands' commands "$@"
}
(( $+functions[_volta__setup_commands] )) ||
_volta__setup_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta setup commands' commands "$@"
}
(( $+functions[_volta__uninstall_commands] )) ||
_volta__uninstall_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta uninstall commands' commands "$@"
}
(( $+functions[_volta__use_commands] )) ||
_volta__use_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta use commands' commands "$@"
}
(( $+functions[_volta__which_commands] )) ||
_volta__which_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'volta which commands' commands "$@"
}

_volta "$@"