-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
dotnet.ts
249 lines (238 loc) · 6.06 KB
/
dotnet.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
import { filepaths } from "@fig/autocomplete-generators";
const DOTNET_ICON =
"https://upload.wikimedia.org/wikipedia/commons/7/7d/Microsoft_.NET_logo.svg";
const commands: Fig.Subcommand[] = [
{
name: "new",
loadSpec: "dotnet/dotnet-new",
icon: DOTNET_ICON,
},
{
name: "add",
loadSpec: "dotnet/dotnet-add",
icon: DOTNET_ICON,
},
{
name: "list",
loadSpec: "dotnet/dotnet-list",
icon: DOTNET_ICON,
},
{
name: "remove",
loadSpec: "dotnet/dotnet-remove",
icon: DOTNET_ICON,
},
{
name: "build",
loadSpec: "dotnet/dotnet-build",
icon: DOTNET_ICON,
},
{
name: "build-server",
loadSpec: "dotnet/dotnet-build-server",
icon: DOTNET_ICON,
},
{
name: "clean",
loadSpec: "dotnet/dotnet-clean",
icon: DOTNET_ICON,
},
{
name: "format",
loadSpec: "dotnet/dotnet-format",
icon: DOTNET_ICON,
},
{
name: "migrate",
loadSpec: "dotnet/dotnet-migrate",
icon: DOTNET_ICON,
},
{
name: "msbuild",
loadSpec: "dotnet/dotnet-msbuild",
icon: DOTNET_ICON,
},
{
name: "nuget",
loadSpec: "dotnet/dotnet-nuget",
icon: DOTNET_ICON,
},
{
name: "pack",
loadSpec: "dotnet/dotnet-pack",
icon: DOTNET_ICON,
},
{
name: "publish",
loadSpec: "dotnet/dotnet-publish",
icon: DOTNET_ICON,
},
{
name: "restore",
loadSpec: "dotnet/dotnet-restore",
icon: DOTNET_ICON,
},
{
name: "run",
loadSpec: "dotnet/dotnet-run",
icon: DOTNET_ICON,
},
{
name: "sln",
loadSpec: "dotnet/dotnet-sln",
icon: DOTNET_ICON,
},
{
name: "store",
loadSpec: "dotnet/dotnet-store",
icon: DOTNET_ICON,
},
{
name: "test",
loadSpec: "dotnet/dotnet-test",
icon: DOTNET_ICON,
},
{
name: "tool",
loadSpec: "dotnet/dotnet-tool",
icon: DOTNET_ICON,
},
];
const completionSpec: Fig.Spec = {
name: "dotnet",
description: "The dotnet cli",
icon: DOTNET_ICON,
args: {
name: "command",
isOptional: true,
generators: filepaths({ extensions: ["dll"] }),
},
options: [
{
name: "--version",
description:
"Prints out the version of the .NET SDK used by dotnet commands. Includes the effects of any global.json",
},
{
name: "--info",
description:
"Prints out detailed information about a .NET installation and the machine environment, such as the current operating system, and commit SHA of the .NET version",
},
{
name: "--list-runtimes",
description:
"Prints out a list of the installed .NET runtimes. An x86 version of the SDK lists only x86 runtimes, and an x64 version of the SDK lists only x64 runtimes",
},
{
name: "--list-sdks",
description: "Prints out a list of the installed .NET SDKs",
},
{
name: ["-?", "-h", "--help"],
description: "Prints out a list of available commands",
},
{
name: ["-d", "--diagnostics"],
description: "Enables diagnostic output",
},
{
name: ["-v", "--verbosity"],
description:
"Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. Not supported in every command. See specific command page to determine if this option is available",
args: {
name: "verbosity",
suggestions: ["quiet", "minimal", "normal", "detailed", "diagnostic"],
},
},
{
name: "--additionalprobingpath",
description: "Path containing probing policy and assemblies to probe",
args: {
name: "path",
template: "folders",
},
},
{
name: "--additional-deps",
description:
"Path to an additional .deps.json file. A deps.json file contains a list of dependencies, compilation dependencies, and version information used to address assembly conflicts. For more information, see Runtime Configuration Files on GitHub",
args: {
name: "deps",
template: "filepaths",
},
},
{
name: "-depsfile",
description:
"Path to the deps.json file. A deps.json file is a configuration file that contains information about dependencies necessary to run the application. This file is generated by the .NET SDK",
args: {
name: "deps",
template: "filepaths",
},
},
{
name: "--runtimeconfig",
description:
"Path to a runtimeconfig.json file. A runtimeconfig.json file is a configuration file that contains run-time settings",
args: {
name: "path",
template: "filepaths",
},
},
{
name: "--roll-forward",
description:
"Controls how roll forward is applied to the app. The SETTING can be one of the following values. If not specified, Minor is the default",
args: {
name: "setting",
suggestions: [
"LatestPatch",
"Minor",
"Major",
"LatestMinor",
"LatestMajor",
"Disable",
],
},
},
{
name: "--fx-version",
description: "Version of the .NET runtime to use to run the application",
args: {
name: "version",
},
},
],
subcommands: commands,
async generateSpec(_, executeShellCommand) {
const argRegex = /(([a-zA-Z \.\[\]#,/][^ ]{1,})+)/g;
const subcommands: Fig.Subcommand[] = [];
const { stdout } = await executeShellCommand({
command: "dotnet",
args: ["tool", "list", "--global"],
});
const lines = stdout.split("\n").slice(2);
for (const line of lines) {
const [_, __, command] = line
.match(argRegex)
.map((match) => match.trim());
const commands = command.split(",").map<Fig.Subcommand>((cmd) => {
const value = cmd.replace("dotnet-", "");
return {
name: value,
description: cmd,
args: {
name: "args",
isOptional: true,
},
};
});
subcommands.push(...commands);
}
return {
name: "dotnet",
subcommands,
};
},
};
export default completionSpec;