forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotnet-nuget.ts
704 lines (690 loc) · 24.3 KB
/
dotnet-nuget.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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
const configFileGenerator: Fig.Generator = {
template: "filepaths",
filterTemplateSuggestions(param) {
const expected = "nuget.config";
return param.filter((file) => {
if (typeof file.name === "string") {
const fileName = file.name;
return fileName === expected;
}
return false;
});
},
};
const nupkgGenerator: Fig.Generator = {
template: "filepaths",
filterTemplateSuggestions(param) {
const suffix = ".nupkg";
return param.filter((file) => {
if (typeof file.name === "string") {
const fileName = file.name;
return fileName.endsWith(suffix);
}
return false;
});
},
};
const sourceCommonOptions: Fig.Option[] = [
{
name: "--configfile",
description:
"The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used",
args: {
name: "file",
generators: configFileGenerator,
},
},
{
name: ["-n", "--name"],
description: "Name of the source",
args: {
name: "name",
},
},
{
name: ["-p", "--password"],
description:
"Password to be used when connecting to an authenticated source",
args: {
name: "password",
},
},
{
name: "--store-password-in-clear-text",
description:
"Enables storing portable package source credentials by disabling password encryption",
args: {
name: "clear-text",
},
},
{
name: ["-u", "--username"],
description:
"Username to be used when connecting to an authenticated source",
args: {
name: "username",
},
},
{
name: "--valid-authentication-types",
description:
"Comma-separated list of valid authentication types for this source. Set this to basic if the server advertises NTLM or Negotiate and your credentials must be sent using the Basic mechanism, for instance when using a PAT with on-premises Azure DevOps Server. Other valid values include negotiate, kerberos, ntlm, and digest, but these values are unlikely to be useful",
args: {
name: "types",
suggestions: ["negotiate", "kerberos", "ntlm", "digest"],
},
},
];
const trustCommonOptions: Fig.Option[] = [
{
name: "--configfile",
description:
"The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used",
args: {
name: "file",
generators: configFileGenerator,
},
},
{
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]. The default is minimal",
args: {
name: "verbosity",
suggestions: ["quiet", "minimal", "normal", "detailed", "diagnostic"],
},
},
];
const completionSpec: Fig.Spec = {
name: "nuget",
subcommands: [
{
name: "delete",
description:
"The dotnet nuget delete command deletes or unlists a package from the server. For nuget.org, the action is to unlist the package",
isDangerous: true,
args: [
{
name: "package_name",
description: "Name/ID of the package to delete",
},
{
name: "package_version",
description: "Version of the package to delete",
},
],
options: [
{
name: "--force-english-output",
description:
"Forces the application to run using an invariant, English-based culture",
},
{
name: "--interactive",
description:
"Allows the command to stop and wait for user input or action. For example, to complete authentication. Available since .NET Core 3.0 SDK",
},
{
name: ["-k", "--api-key"],
description: "The API key for the server",
args: {
name: "key",
},
},
{
name: "--no-service-endpoint",
description:
'Doesn\'t append "api/v2/package" to the source URL. Option available since .NET Core 2.1 SDK',
},
{
name: "--non-interactive",
description: "Doesn't prompt for user input or confirmations",
},
{
name: ["-s", "--source"],
description:
"Specifies the server URL. Supported URLs for nuget.org include https://www.nuget.org, https://www.nuget.org/api/v3, and https://www.nuget.org/api/v2/package. For private feeds, replace the host name (for example, %hostname%/api/v3)",
args: {
name: "source",
},
},
],
},
{
name: "locals",
description:
"The dotnet nuget locals command clears or lists local NuGet resources in the http-request cache, temporary cache, or machine-wide global packages folder",
args: {
name: "cache_location",
suggestions: ["all", "http-cache", "global-packages", "temp"],
},
options: [
{
name: ["-c", "--clear"],
description:
"The clear option executes a clear operation on the specified cache type. The contents of the cache directories are deleted recursively. The executing user/group must have permission to the files in the cache directories. If not, an error is displayed indicating the files/folders that weren't cleared",
},
{
name: ["-l", "--list"],
description:
"The list option is used to display the location of the specified cache type",
},
],
},
{
name: "push",
description:
"The dotnet nuget push command pushes a package to the server and publishes it. The push command uses server and credential details found in the system's NuGet config file or chain of config files. For more information on config files, see Configuring NuGet Behavior. NuGet's default configuration is obtained by loading %AppData%NuGetNuGet.config (Windows) or $HOME/.local/share (Linux/macOS), then loading any nuget.config or .nuget\nuget.config starting from the root of drive and ending in the current directory",
args: {
name: "root",
description: "Specifies the file path to the package to be pushed",
generators: nupkgGenerator,
},
options: [
{
name: ["-d", "--disable-buffering"],
description:
"Disables buffering when pushing to an HTTP(S) server to reduce memory usage",
},
{
name: "--force-english-output",
description:
"Forces the application to run using an invariant, English-based culture",
},
{
name: "--interactive",
description:
"Allows the command to stop and wait for user input or action. For example, to complete authentication. Available since .NET Core 3.0 SDK",
},
{
name: ["-k", "--api-key"],
description: "The API key for the server",
args: {
name: "key",
},
},
{
name: ["-n", "--no-symbols"],
description: "Doesn't push symbols (even if present)",
},
{
name: "--no-service-endpoint",
description:
'Doesn\'t append "api/v2/package" to the source URL. Option available since .NET Core 2.1 SDK',
},
{
name: ["-s", "--source"],
description:
"Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP",
args: {
name: "source",
},
},
{
name: "--skip-duplicate",
description:
"When pushing multiple packages to an HTTP(S) server, treats any 409 Conflict response as a warning so that the push can continue. Available since .NET Core 3.1 SDK",
},
{
name: ["-sk", "--symbol-api-key"],
description: "The API key for the symbol server",
args: {
name: "key",
},
},
{
name: ["-ss", "--symbol-source"],
description: "Specifies the symbol server URL",
args: {
name: "symbol_source",
},
},
{
name: ["-t", "--timeout"],
description:
"Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes). Specifying 0 applies the default value",
args: {
name: "timeout",
isOptional: true,
default: "300",
},
},
],
},
{
name: "add",
subcommands: [
{
name: "source",
description:
"The dotnet nuget add source command adds a new package source to your NuGet configuration files",
args: {
name: "package_source",
description: "Path to the package source",
},
options: sourceCommonOptions,
},
],
},
{
name: "disable",
subcommands: [
{
name: "source",
description:
"The dotnet nuget disable source command disables an existing source in your NuGet configuration files",
args: {
name: "name",
description: "Name of the source",
},
options: [
{
name: "--configfile",
description:
"The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used",
args: {
name: "file",
generators: configFileGenerator,
},
},
],
},
],
},
{
name: "enable",
subcommands: [
{
name: "source",
description:
"The dotnet nuget enable source command enables an existing source in your NuGet configuration files",
args: {
name: "name",
description: "Name of the source",
},
options: [
{
name: "--configfile",
description:
"The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used",
args: {
name: "file",
generators: configFileGenerator,
},
},
],
},
],
},
{
name: "list",
subcommands: [
{
name: "source",
description:
"The dotnet nuget list source command lists all existing sources from your NuGet configuration files",
},
],
options: [
{
name: "--configfile",
description:
"The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used",
args: {
name: "file",
generators: configFileGenerator,
},
},
{
name: "--format",
description:
"The format of the list command output: Detailed (the default) and Short",
args: {
name: "output",
suggestions: ["Detailed", "Short"],
},
},
],
},
{
name: "remove",
subcommands: [
{
name: "source",
description:
"The dotnet nuget remove source command removes an existing source from your NuGet configuration files",
args: {
name: "name",
description: "Name of the source",
},
options: [
{
name:
"The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used.",
args: {
name: "file",
generators: configFileGenerator,
},
},
],
},
],
},
{
name: "update",
subcommands: [
{
name: "source",
description:
"The dotnet nuget update source command updates an existing source in your NuGet configuration files",
args: {
name: "name",
description: "Name of the source",
},
options: sourceCommonOptions,
},
],
},
{
name: "verify",
description:
"The dotnet nuget verify command verifies a signed NuGet package",
args: {
name: "package-path",
description:
"Specifies the file path to the package(s) to be verified. Multiple position arguments can be passed in to verify multiple packages",
generators: nupkgGenerator,
},
options: [
{
name: "--all",
description:
"Specifies that all verifications possible should be performed on the package(s). By default, only signatures are verified",
},
{
name: "--certificate-fingerprint",
description:
"Verify that the signer certificate matches with one of the specified SHA256 fingerprints. This option can be supplied multiple times to provide multiple fingerprints",
args: {
name: "fingerprint",
},
},
{
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: "trust",
description:
"The dotnet nuget trust command manages the trusted signers. By default, NuGet accepts all authors and repositories. These commands allow you to specify only a specific subset of signers whose signatures will be accepted, while rejecting all others",
subcommands: [
{
name: "list",
description:
"Lists all the trusted signers in the configuration. This option will include all the certificates (with fingerprint and fingerprint algorithm) each signer has. If a certificate has a preceding [U], it means that certificate entry has allowUntrustedRoot set as true",
options: trustCommonOptions,
},
{
name: "sync",
description:
"Deletes the current list of certificates and replaces them with an up-to-date list from the repository",
options: trustCommonOptions,
},
{
name: "remove",
description: "Removes any trusted signers that match the given name",
args: {
name: "name",
description: "The name of the existing trusted signer to remove",
},
options: trustCommonOptions,
},
{
name: "author",
description:
"Adds a trusted signer with the given name, based on the author signature of the package",
args: [
{
name: "name",
description:
"The name of the trusted signer to add. If NAME already exists in the configuration, the signature is appended",
},
{
name: "package",
description:
"The given PACKAGE should be a local path to the signed .nupkg file",
},
],
options: [
{
name: "--allow-untrusted-root",
description:
"Specifies if the certificate for the trusted signer should be allowed to chain to an untrusted root. This is not recommended",
},
...trustCommonOptions,
],
},
{
name: "repository",
description:
"Adds a trusted signer with the given name, based on the repository signature or countersignature of a signed package",
args: [
{
name: "name",
description:
"The name of the trusted signer to add. If NAME already exists in the configuration, the signature is appended",
},
{
name: "package",
description:
"The given PACKAGE should be a local path to the signed .nupkg file",
},
],
options: [
{
name: "--allow-untrusted-root",
description:
"Specifies if the certificate for the trusted signer should be allowed to chain to an untrusted root. This is not recommended",
},
{
name: "--owners",
description:
"Semicolon-separated list of trusted owners to further restrict the trust of a repository",
},
...trustCommonOptions,
],
},
{
name: "certificate",
description:
"Adds a trusted signer with the given name, based on a certificate fingerprint",
args: [
{
name: "name",
description:
"The name of the trusted signer to add. If a trusted signer with the given name already exists, the certificate item is added to that signer. Otherwise a trusted author is created with a certificate item from the given certificate information",
},
{
name: "fingerprint",
description: "The fingerprint of the certificate",
},
],
options: [
{
name: "--algorithm",
description:
"Specifies the hash algorithm used to calculate the certificate fingerprint. Defaults to SHA256. Values supported are SHA256, SHA384 and SHA512",
},
...trustCommonOptions,
],
},
{
name: "source",
description: "Adds a trusted signer based on a given package source",
args: {
name: "name",
},
options: [
{
name: "owners",
description:
"Semicolon-separated list of trusted owners to further restrict the trust of a repository",
},
{
name: "--source-url",
description:
"If a source-url is provided, it must be a v3 package source URL (like https://api.nuget.org/v3/index.json). Other package source types are not supported",
args: {
name: "source-url",
},
},
...trustCommonOptions,
],
},
],
},
{
name: "sign",
description:
"The dotnet nuget sign command signs all the packages matching the first argument with a certificate. The certificate with the private key can be obtained from a file or from a certificate installed in a certificate store by providing a subject name or a SHA-1 fingerprint",
args: {
name: "package-paths",
description:
"Specifies the file path to the package(s) to be signed. Multiple arguments can be passed in to sign multiple packages",
isVariadic: true,
},
options: [
{
name: "--certificate-path",
description:
"Specifies the file path to the certificate to be used in signing the package",
args: {
name: "path",
generators: {
template: "filepaths",
filterTemplateSuggestions(param) {
const suffix = ".pfx";
return param.filter((file) => {
if (typeof file.name === "string") {
const fileName = file.name;
return fileName.endsWith(suffix);
}
return false;
});
},
},
},
},
{
name: "--certificate-store-name",
description:
'Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to "My", the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via --certificate-subject-name or --certificate-fingerprint options',
args: {
name: "storename",
},
},
{
name: "--certificate-store-location",
description:
'Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to "CurrentUser", the X.509 certificate store used by the current user. This option should be used when specifying the certificate via --certificate-subject-name or --certificate-fingerprint options',
args: {
name: "location",
},
},
{
name: "--certificate-subject-name",
description:
"Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which will find all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by --certificate-store-name and --certificate-store-location options",
args: {
name: "subjectname",
},
},
{
name: "--certificate-fingerprint",
description:
"SHA-1 fingerprint of the certificate used to search a local certificate store for the certificate",
args: {
name: "fingerprint",
},
},
{
name: "--certificate-password",
description:
"Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the sign command will fail",
args: {
name: "password",
},
},
{
name: "--hash-algorithm",
description:
"Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512",
args: {
name: "algorithm",
suggestions: ["SHA256", "SHA384", "SHA512"],
},
},
{
name: ["-o", "--output"],
description:
"Specifies the directory where the signed package should be saved. If this option is not specified, by default the original package is overwritten by the signed package",
args: {
name: "directory",
template: "folders",
},
},
{
name: "--overwrite",
description:
"Indicate that the current signature should be overwritten. By default the command will fail if the package already has a signature",
isDangerous: true,
},
{
name: "--timestamp-hash-algorithm",
description:
"Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256",
args: {
name: "algoritm",
suggestions: ["SHA256"],
},
},
{
name: "--timestamper",
description: "URL to an RFC 3161 timestamping server",
args: {
name: "url",
},
},
{
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]. The default is minimal",
args: {
name: "verbosity",
suggestions: [
"quiet",
"minimal",
"normal",
"detailed",
"diagnostic",
],
},
},
],
},
],
};
export default completionSpec;