-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathvolta.ts
194 lines (191 loc) · 4.39 KB
/
volta.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
const defaultOptions: Fig.Option[] = [
{
name: "--verbose",
description: "Enables verbose diagnostics",
},
{
name: "--quiet",
description: "Prevents unnecessary output",
},
{
name: ["-h", "--help"],
description: "Prints help information",
},
];
const toolArgs: Fig.Arg = {
isVariadic: true,
name: "tool@version",
};
const completionSpec: Fig.Spec = {
name: "volta",
description: "The JavaScript Launcher",
subcommands: [
{
name: "fetch",
description: "Fetches a tool to the local machine",
args: {
isVariadic: true,
name: "tool | tool@version",
},
options: [...defaultOptions],
},
{
name: "install",
description: "Installs a tool in your toolchain",
args: {
...toolArgs,
},
options: [...defaultOptions],
},
{
name: "uninstall",
description: "Uninstalls a tool from your toolchain",
args: {
name: "tool",
},
options: [...defaultOptions],
},
{
name: "pin",
description: "Pins your project's runtime or package manager",
args: {
...toolArgs,
},
options: [...defaultOptions],
},
{
name: "list",
description: "Displays the current toolchain",
args: {
name: "tool",
},
options: [
{
name: ["-c", "--current"],
description: "Show the currently-active tool(s)",
},
{
name: ["-d", "--default"],
description: "Show your default tool(s)",
},
...defaultOptions,
{
name: "--format",
description: "Specify output format",
args: {
name: "output format",
suggestions: ["human", "plain"],
},
},
],
},
{
name: "completions",
description: "Generates Volta completions",
args: {
name: "shell",
description: "Shell to generate completions for",
suggestions: ["zsh", "bash", "fish", "powershell", "elivsh"],
},
options: [
{
name: ["-f", "--force"],
description: "Write over an existing file, if any",
},
...defaultOptions,
{
name: ["-o", "--output"],
description: "File to write generated completions to",
args: {
name: "file",
},
},
],
},
{
name: "which",
description: "Locates the actual binary that will be called by Volta",
args: {
isVariadic: true,
name: "binary",
template: "filepaths",
},
options: [...defaultOptions],
},
{
name: "setup",
description: "Enables Volta for the current user",
options: [...defaultOptions],
},
{
name: "run",
description: "Run a command with custom Node, npm, and/or Yarn versions",
args: {
name: "command",
},
options: [
{
name: "--bundle",
description: "Forces npm to be the version bundled with Node",
},
{
name: "--no-yarn",
description: "Disables Yarn",
},
{
name: "--verbose",
description: "Enables verbose diagnostics",
},
{
name: "--quiet",
description: "Prevents unnecessary output",
},
{
name: "--node",
description: "Set the custom Node version",
args: {
name: "version",
},
},
{
name: "--npm",
description: "Set the custom npm version",
args: {
name: "version",
},
},
{
name: "--yarn",
description: "Set the custom Yarn version",
args: {
name: "version",
},
},
{
name: "--env",
description:
"Set an environment variable (can be used multiple times)",
isRepeatable: true,
args: {
name: "NAME=value",
},
},
],
},
{
name: "help",
description: "Prints this message or the help of the given subcommand(s)",
args: {
name: "subcommand",
},
},
],
options: [
...defaultOptions,
{
name: ["-v", "--version"],
description: "Prints the current version of Volta",
},
],
};
export default completionSpec;