forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nvm.ts
316 lines (304 loc) · 7.69 KB
/
nvm.ts
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
// args
const version: Fig.Arg = {
name: "version",
description: "node version",
suggestions: [
{
name: "node",
description: "the latest version of node",
},
{
name: "iojs",
description: "the latest version of io.js",
},
{
name: "system",
description: "system-installed version of node",
},
],
};
const command: Fig.Arg = {
name: "command",
variadic: true,
};
const args: Fig.Arg = {
name: "args",
variadic: true,
};
const pattern: Fig.Arg = {
name: "pattern",
};
const name: Fig.Arg = {
name: "name",
};
const ltsName: Fig.Arg = {
name: "LTS name",
};
const colorCodes: Fig.Arg = {
name: "color codes",
description: 'using format "yMeBg"',
};
// options
const noColors: Fig.Option = {
name: "--no-colors",
description: "Suppress colored output",
};
const noAlias: Fig.Option = {
name: "--no-alias",
description: "Suppress `nvm alias` output",
};
const silent: Fig.Option = {
name: "--silent",
description: "Silences stdout/stderr output",
};
const lts: Fig.Option = {
name: "--lts",
description:
"Uses automatic LTS (long-term support) alias `lts/*`, if available.",
};
const ltsWithName: Fig.Option = {
name: "--lts",
description: "Uses automatic alias for provided LTS line, if available.",
args: [ltsName],
};
export const completionSpec: Fig.Spec = {
name: "nvm",
description: "Node Package Manager",
subcommands: [
{
name: "install",
description:
"Download and install a <version>. Uses .nvmrc if available and version is omitted.",
args: [{ ...version, isOptional: true }],
options: [
{
name: "-s",
description: "Skip binary download, install from source only.",
},
{
name: "--reinstall-packages-from",
description:
"When installing, reinstall packages installed in <version>",
args: [version],
},
{
...lts,
description:
"When installing, only select from LTS (long-term support) versions",
},
{
...ltsWithName,
description:
"When installing, only select from versions for a specific LTS line",
},
{
name: "--skip-default-packages",
description:
"When installing, skip the default-packages file if it exists",
},
{
name: "--latest-npm",
description:
"After installing, attempt to upgrade to the latest working npm on the given node version",
},
{
name: "--no-progress",
description: "Disable the progress bar on any downloads",
},
{
name: "--alias",
description:
"After installing, set the alias specified to the version specified. (same as: nvm alias <name> <version>)",
args: [name],
},
{
name: "--default",
description:
"After installing, set default alias to the version specified. (same as: nvm alias default <version>)",
},
],
},
{
name: "uninstall",
description: "Uninstall a version",
args: [version],
options: [
{
...lts,
description:
"Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.",
},
{
...ltsWithName,
description:
"Uninstall using automatic alias for provided LTS line, if available.",
},
],
},
{
name: "use",
description:
"Modify PATH to use <version>. Uses .nvmrc if available and version is omitted.",
args: [{ ...version, isOptional: true }],
options: [silent, lts, ltsWithName],
},
{
name: "exec",
description:
"Run <command> on <version>. Uses .nvmrc if available and version is omitted.",
args: [{ ...version, isOptional: true }, command],
options: [silent, lts, ltsWithName],
},
{
name: "run",
description:
"Run `node` on <version> with <args> as arguments. Uses .nvmrc if available and version is omitted.",
args: [{ ...version, isOptional: true }, args],
options: [silent, lts, ltsWithName],
},
{
name: "current",
description: "Display currently activated version of Node",
},
{
name: "ls",
description:
"List installed versions, matching a given <version> if provided",
args: [version],
options: [noColors, noAlias],
},
{
name: "ls-remote",
description:
"List remote versions available for install, matching a given <version> if provided",
args: [version],
options: [
{
...lts,
description:
"When listing, only show LTS (long-term support) versions",
},
{
...ltsWithName,
description:
"When listing, only show versions for a specific LTS line",
},
noColors,
],
},
{
name: "version",
description: "Resolve the given description to a single local version",
args: [version],
},
{
name: "version-remote",
description: "Resolve the given description to a single remote version",
args: [version],
options: [
{
...lts,
description:
"When listing, only show LTS (long-term support) versions",
},
{
...ltsWithName,
description:
"When listing, only show versions for a specific LTS line",
},
],
},
{
name: "deactivate",
description: "Undo effects of `nvm` on current shell",
options: [silent],
},
{
name: "alias",
description:
"Show all aliases beginning with <pattern> or Set an alias named <name> pointing to <version>",
args: [
{
name: "pattern or name",
description: "pattern or name",
},
{
name: "version",
isOptional: true,
},
],
},
{
name: "unalias",
description: "Deletes the alias named <name>",
args: [name],
},
{
name: "install-latest-npm",
description:
"Attempt to upgrade to the latest working `npm` on the current node version",
},
{
name: "reinstall-packages",
description:
"Reinstall global `npm` packages contained in <version> to current version",
args: [version],
},
{
name: "unload",
description: "Unload `nvm` from shell",
},
{
name: "which",
description:
"Display path to installed node version. Uses .nvmrc if available and version is omitted.",
args: [{ ...version, isOptional: true }],
subcommands: [
{
name: "current",
},
],
options: [
{
...silent,
description:
"Silences stdout/stderr output when a version is omitted",
},
],
},
{
name: "cache",
args: {
suggestions: [
{
name: "dir",
description: "Display path to the cache directory for nvm",
type: "subcommand",
},
{
name: "clear",
description: "Empty cache directory for nvm",
type: "subcommand",
},
],
},
},
{
name: "set-colors",
description:
'Set five text colors using format "yMeBg". Available when supported.',
args: [colorCodes],
},
],
options: [
{
name: "--help",
description: "Show help page",
},
{
name: "--version",
description: "Print out the installed version of nvm",
},
noColors,
],
};