@rushstack/ts-command-line 4.18.0 → 4.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/ts-command-line.d.ts +67 -23
  2. package/lib/index.d.ts +1 -1
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +2 -1
  5. package/lib/index.js.map +1 -1
  6. package/lib/parameters/BaseClasses.d.ts +26 -4
  7. package/lib/parameters/BaseClasses.d.ts.map +1 -1
  8. package/lib/parameters/BaseClasses.js +6 -12
  9. package/lib/parameters/BaseClasses.js.map +1 -1
  10. package/lib/parameters/CommandLineChoiceListParameter.d.ts +5 -5
  11. package/lib/parameters/CommandLineChoiceListParameter.d.ts.map +1 -1
  12. package/lib/parameters/CommandLineChoiceListParameter.js +3 -6
  13. package/lib/parameters/CommandLineChoiceListParameter.js.map +1 -1
  14. package/lib/parameters/CommandLineChoiceParameter.d.ts +6 -6
  15. package/lib/parameters/CommandLineChoiceParameter.d.ts.map +1 -1
  16. package/lib/parameters/CommandLineChoiceParameter.js +3 -6
  17. package/lib/parameters/CommandLineChoiceParameter.js.map +1 -1
  18. package/lib/parameters/CommandLineDefinition.d.ts +16 -4
  19. package/lib/parameters/CommandLineDefinition.d.ts.map +1 -1
  20. package/lib/parameters/CommandLineDefinition.js.map +1 -1
  21. package/lib/parameters/CommandLineFlagParameter.d.ts +5 -5
  22. package/lib/parameters/CommandLineFlagParameter.d.ts.map +1 -1
  23. package/lib/parameters/CommandLineFlagParameter.js +3 -6
  24. package/lib/parameters/CommandLineFlagParameter.js.map +1 -1
  25. package/lib/parameters/CommandLineIntegerListParameter.d.ts +3 -3
  26. package/lib/parameters/CommandLineIntegerListParameter.d.ts.map +1 -1
  27. package/lib/parameters/CommandLineIntegerListParameter.js +2 -5
  28. package/lib/parameters/CommandLineIntegerListParameter.js.map +1 -1
  29. package/lib/parameters/CommandLineIntegerParameter.d.ts +4 -4
  30. package/lib/parameters/CommandLineIntegerParameter.d.ts.map +1 -1
  31. package/lib/parameters/CommandLineIntegerParameter.js +2 -5
  32. package/lib/parameters/CommandLineIntegerParameter.js.map +1 -1
  33. package/lib/parameters/CommandLineRemainder.d.ts +1 -1
  34. package/lib/parameters/CommandLineRemainder.d.ts.map +1 -1
  35. package/lib/parameters/CommandLineRemainder.js +0 -1
  36. package/lib/parameters/CommandLineRemainder.js.map +1 -1
  37. package/lib/parameters/CommandLineStringListParameter.d.ts +3 -3
  38. package/lib/parameters/CommandLineStringListParameter.d.ts.map +1 -1
  39. package/lib/parameters/CommandLineStringListParameter.js +2 -5
  40. package/lib/parameters/CommandLineStringListParameter.js.map +1 -1
  41. package/lib/parameters/CommandLineStringParameter.d.ts +4 -4
  42. package/lib/parameters/CommandLineStringParameter.d.ts.map +1 -1
  43. package/lib/parameters/CommandLineStringParameter.js +2 -5
  44. package/lib/parameters/CommandLineStringParameter.js.map +1 -1
  45. package/lib/providers/AliasCommandLineAction.d.ts +1 -1
  46. package/lib/providers/AliasCommandLineAction.d.ts.map +1 -1
  47. package/lib/providers/AliasCommandLineAction.js +13 -19
  48. package/lib/providers/AliasCommandLineAction.js.map +1 -1
  49. package/lib/providers/CommandLineAction.d.ts +2 -8
  50. package/lib/providers/CommandLineAction.d.ts.map +1 -1
  51. package/lib/providers/CommandLineAction.js +0 -7
  52. package/lib/providers/CommandLineAction.js.map +1 -1
  53. package/lib/providers/CommandLineParameterProvider.d.ts +38 -4
  54. package/lib/providers/CommandLineParameterProvider.d.ts.map +1 -1
  55. package/lib/providers/CommandLineParameterProvider.js +118 -43
  56. package/lib/providers/CommandLineParameterProvider.js.map +1 -1
  57. package/lib/providers/CommandLineParser.d.ts.map +1 -1
  58. package/lib/providers/CommandLineParser.js +20 -0
  59. package/lib/providers/CommandLineParser.js.map +1 -1
  60. package/lib/providers/ScopedCommandLineAction.d.ts +6 -3
  61. package/lib/providers/ScopedCommandLineAction.d.ts.map +1 -1
  62. package/lib/providers/ScopedCommandLineAction.js +4 -1
  63. package/lib/providers/ScopedCommandLineAction.js.map +1 -1
  64. package/lib/providers/TabCompletionAction.d.ts +2 -2
  65. package/lib/providers/TabCompletionAction.d.ts.map +1 -1
  66. package/lib/providers/TabCompletionAction.js +5 -7
  67. package/lib/providers/TabCompletionAction.js.map +1 -1
  68. package/package.json +1 -1
@@ -58,7 +58,6 @@ export declare abstract class CommandLineAction extends CommandLineParameterProv
58
58
  private _argumentParser;
59
59
  constructor(options: ICommandLineActionOptions);
60
60
  /* Excluded from this release type: _buildParser */
61
- /* Excluded from this release type: _processParsedData */
62
61
  /* Excluded from this release type: _execute */
63
62
  /* Excluded from this release type: _getArgumentParser */
64
63
  /**
@@ -77,9 +76,9 @@ export declare class CommandLineChoiceListParameter<TChoice extends string = str
77
76
  private _values;
78
77
  /** {@inheritDoc ICommandLineChoiceListDefinition.completions} */
79
78
  readonly completions: (() => Promise<TChoice[]>) | undefined;
80
- /* Excluded from this release type: __constructor */
81
79
  /** {@inheritDoc CommandLineParameter.kind} */
82
- get kind(): CommandLineParameterKind;
80
+ readonly kind: CommandLineParameterKind.ChoiceList;
81
+ /* Excluded from this release type: __constructor */
83
82
  /* Excluded from this release type: _setValue */
84
83
  /**
85
84
  * Returns the string arguments for a choice list parameter that was parsed from the command line.
@@ -105,9 +104,9 @@ export declare class CommandLineChoiceParameter<TChoice extends string = string>
105
104
  private _value;
106
105
  /** {@inheritDoc ICommandLineChoiceDefinition.completions} */
107
106
  readonly completions: (() => Promise<TChoice[]>) | undefined;
108
- /* Excluded from this release type: __constructor */
109
107
  /** {@inheritDoc CommandLineParameter.kind} */
110
- get kind(): CommandLineParameterKind;
108
+ readonly kind: CommandLineParameterKind.Choice;
109
+ /* Excluded from this release type: __constructor */
111
110
  /* Excluded from this release type: _setValue */
112
111
  /* Excluded from this release type: _getSupplementaryNotes */
113
112
  /**
@@ -140,9 +139,9 @@ export declare const enum CommandLineConstants {
140
139
  */
141
140
  export declare class CommandLineFlagParameter extends CommandLineParameter {
142
141
  private _value;
143
- /* Excluded from this release type: __constructor */
144
142
  /** {@inheritDoc CommandLineParameter.kind} */
145
- get kind(): CommandLineParameterKind;
143
+ readonly kind: CommandLineParameterKind.Flag;
144
+ /* Excluded from this release type: __constructor */
146
145
  /* Excluded from this release type: _setValue */
147
146
  /**
148
147
  * Returns a boolean indicating whether the parameter was included in the command line.
@@ -176,9 +175,9 @@ export declare class CommandLineHelper {
176
175
  */
177
176
  export declare class CommandLineIntegerListParameter extends CommandLineParameterWithArgument {
178
177
  private _values;
179
- /* Excluded from this release type: __constructor */
180
178
  /** {@inheritDoc CommandLineParameter.kind} */
181
- get kind(): CommandLineParameterKind;
179
+ readonly kind: CommandLineParameterKind.IntegerList;
180
+ /* Excluded from this release type: __constructor */
182
181
  /* Excluded from this release type: _setValue */
183
182
  /**
184
183
  * Returns the integer arguments for an integer list parameter that was parsed from the command line.
@@ -200,9 +199,9 @@ export declare class CommandLineIntegerParameter extends CommandLineParameterWit
200
199
  /** {@inheritDoc ICommandLineStringDefinition.defaultValue} */
201
200
  readonly defaultValue: number | undefined;
202
201
  private _value;
203
- /* Excluded from this release type: __constructor */
204
202
  /** {@inheritDoc CommandLineParameter.kind} */
205
- get kind(): CommandLineParameterKind;
203
+ readonly kind: CommandLineParameterKind.Integer;
204
+ /* Excluded from this release type: __constructor */
206
205
  /* Excluded from this release type: _setValue */
207
206
  /* Excluded from this release type: _getSupplementaryNotes */
208
207
  /**
@@ -224,6 +223,9 @@ export declare class CommandLineIntegerParameter extends CommandLineParameterWit
224
223
  export declare abstract class CommandLineParameter {
225
224
  private _shortNameValue;
226
225
  /* Excluded from this release type: _parserKey */
226
+ /* Excluded from this release type: _preParse */
227
+ /* Excluded from this release type: _postParse */
228
+ /* Excluded from this release type: _validateValue */
227
229
  /** {@inheritDoc IBaseCommandLineDefinition.parameterLongName} */
228
230
  readonly longName: string;
229
231
  /**
@@ -241,6 +243,8 @@ export declare abstract class CommandLineParameter {
241
243
  readonly required: boolean;
242
244
  /** {@inheritDoc IBaseCommandLineDefinition.environmentVariable} */
243
245
  readonly environmentVariable: string | undefined;
246
+ /** {@inheritDoc IBaseCommandLineDefinition.allowNonStandardEnvironmentVariableNames} */
247
+ readonly allowNonStandardEnvironmentVariableNames: boolean | undefined;
244
248
  /** {@inheritDoc IBaseCommandLineDefinition.undocumentedSynonyms } */
245
249
  readonly undocumentedSynonyms: string[] | undefined;
246
250
  /* Excluded from this release type: __constructor */
@@ -269,10 +273,12 @@ export declare abstract class CommandLineParameter {
269
273
  /**
270
274
  * Internal usage only. Used to report unexpected output from the argparse library.
271
275
  */
272
- protected reportInvalidData(data: any): never;
276
+ protected reportInvalidData(data: unknown): never;
273
277
  protected validateDefaultValue(hasDefaultValue: boolean): void;
274
278
  }
275
279
 
280
+ declare type CommandLineParameter_2 = CommandLineChoiceListParameter | CommandLineChoiceParameter | CommandLineFlagParameter | CommandLineIntegerListParameter | CommandLineIntegerParameter | CommandLineStringListParameter | CommandLineStringParameter;
281
+
276
282
  /**
277
283
  * Identifies the kind of a CommandLineParameter.
278
284
  * @public
@@ -337,6 +343,7 @@ export declare abstract class CommandLineParameterProvider {
337
343
  */
338
344
  defineChoiceParameter<TChoice extends string = string>(definition: ICommandLineChoiceDefinition<TChoice> & {
339
345
  required: false | undefined;
346
+ defaultValue: undefined;
340
347
  }): CommandLineChoiceParameter<TChoice>;
341
348
  /**
342
349
  * {@inheritdoc CommandLineParameterProvider.(defineChoiceParameter:1)}
@@ -344,6 +351,12 @@ export declare abstract class CommandLineParameterProvider {
344
351
  defineChoiceParameter<TChoice extends string = string>(definition: ICommandLineChoiceDefinition<TChoice> & {
345
352
  required: true;
346
353
  }): IRequiredCommandLineChoiceParameter<TChoice>;
354
+ /**
355
+ * {@inheritdoc CommandLineParameterProvider.(defineChoiceParameter:1)}
356
+ */
357
+ defineChoiceParameter<TChoice extends string = string>(definition: ICommandLineChoiceDefinition<TChoice> & {
358
+ defaultValue: TChoice;
359
+ }): IRequiredCommandLineChoiceParameter<TChoice>;
347
360
  /**
348
361
  * {@inheritdoc CommandLineParameterProvider.(defineChoiceParameter:1)}
349
362
  */
@@ -400,6 +413,7 @@ export declare abstract class CommandLineParameterProvider {
400
413
  */
401
414
  defineIntegerParameter(definition: ICommandLineIntegerDefinition & {
402
415
  required: false | undefined;
416
+ defaultValue: undefined;
403
417
  }): CommandLineIntegerParameter;
404
418
  /**
405
419
  * {@inheritdoc CommandLineParameterProvider.(defineIntegerParameter:1)}
@@ -407,6 +421,12 @@ export declare abstract class CommandLineParameterProvider {
407
421
  defineIntegerParameter(definition: ICommandLineIntegerDefinition & {
408
422
  required: true;
409
423
  }): IRequiredCommandLineIntegerParameter;
424
+ /**
425
+ * {@inheritdoc CommandLineParameterProvider.(defineIntegerParameter:1)}
426
+ */
427
+ defineIntegerParameter(definition: ICommandLineIntegerDefinition & {
428
+ defaultValue: number;
429
+ }): IRequiredCommandLineIntegerParameter;
410
430
  /**
411
431
  * {@inheritdoc CommandLineParameterProvider.(defineIntegerParameter:1)}
412
432
  */
@@ -445,6 +465,7 @@ export declare abstract class CommandLineParameterProvider {
445
465
  */
446
466
  defineStringParameter(definition: ICommandLineStringDefinition & {
447
467
  required: false | undefined;
468
+ defaultValue: undefined;
448
469
  }): CommandLineStringParameter;
449
470
  /**
450
471
  * {@inheritdoc CommandLineParameterProvider.(defineStringParameter:1)}
@@ -452,6 +473,12 @@ export declare abstract class CommandLineParameterProvider {
452
473
  defineStringParameter(definition: ICommandLineStringDefinition & {
453
474
  required: true;
454
475
  }): IRequiredCommandLineStringParameter;
476
+ /**
477
+ * {@inheritdoc CommandLineParameterProvider.(defineStringParameter:1)}
478
+ */
479
+ defineStringParameter(definition: ICommandLineStringDefinition & {
480
+ defaultValue: string;
481
+ }): IRequiredCommandLineStringParameter;
455
482
  /**
456
483
  * {@inheritdoc CommandLineParameterProvider.(defineStringParameter:1)}
457
484
  */
@@ -520,6 +547,8 @@ export declare abstract class CommandLineParameterProvider {
520
547
  */
521
548
  protected onDefineParameters?(): void;
522
549
  /* Excluded from this release type: _getArgumentParser */
550
+ /* Excluded from this release type: _preParse */
551
+ /* Excluded from this release type: _postParse */
523
552
  /* Excluded from this release type: _processParsedData */
524
553
  /* Excluded from this release type: _defineParameter */
525
554
  /* Excluded from this release type: _defineAmbiguousParameter */
@@ -651,9 +680,9 @@ export declare class CommandLineRemainder {
651
680
  */
652
681
  export declare class CommandLineStringListParameter extends CommandLineParameterWithArgument {
653
682
  private _values;
654
- /* Excluded from this release type: __constructor */
655
683
  /** {@inheritDoc CommandLineParameter.kind} */
656
- get kind(): CommandLineParameterKind;
684
+ readonly kind: CommandLineParameterKind.StringList;
685
+ /* Excluded from this release type: __constructor */
657
686
  /* Excluded from this release type: _setValue */
658
687
  /**
659
688
  * Returns the string arguments for a string list parameter that was parsed from the command line.
@@ -675,9 +704,9 @@ export declare class CommandLineStringParameter extends CommandLineParameterWith
675
704
  /** {@inheritDoc ICommandLineStringDefinition.defaultValue} */
676
705
  readonly defaultValue: string | undefined;
677
706
  private _value;
678
- /* Excluded from this release type: __constructor */
679
707
  /** {@inheritDoc CommandLineParameter.kind} */
680
- get kind(): CommandLineParameterKind;
708
+ readonly kind: CommandLineParameterKind.String;
709
+ /* Excluded from this release type: __constructor */
681
710
  /* Excluded from this release type: _setValue */
682
711
  /* Excluded from this release type: _getSupplementaryNotes */
683
712
  /**
@@ -769,10 +798,9 @@ export declare interface IBaseCommandLineDefinition {
769
798
  *
770
799
  * @remarks
771
800
  * The environment variable name must consist only of upper-case letters, numbers,
772
- * and underscores. It may not start with a number.
773
- *
774
- * This feature cannot be used when {@link IBaseCommandLineDefinition.required} is true,
775
- * because in that case the environmentVariable would never be used.
801
+ * and underscores. It may not start with a number. To disable this validation, set
802
+ * `{@link IBaseCommandLineDefinition.allowNonStandardEnvironmentVariableNames}`
803
+ * to `true`.
776
804
  *
777
805
  * Syntax notes for environment variable values:
778
806
  *
@@ -797,6 +825,19 @@ export declare interface IBaseCommandLineDefinition {
797
825
  * ordinary String Parameter: Any value is accepted, including an empty string.
798
826
  */
799
827
  environmentVariable?: string;
828
+ /**
829
+ * Allows for the use of environment variable names that do not conform to the standard
830
+ * described by the Shell and Utilities volume of IEEE Std 1003.1-2001. This disables
831
+ * the validation that is performed on the provided
832
+ * {@link IBaseCommandLineDefinition.environmentVariable} value by default.
833
+ *
834
+ * @remarks
835
+ * if this is set to `true`, environment variable discovery will vary based on the
836
+ * platform in use. For example, Windows environment variable names are case-insensitive,
837
+ * while on Linux, environment variable names are case-sensitive. It is recommended that
838
+ * this option be used only when necessary based on environmental constraints.
839
+ */
840
+ allowNonStandardEnvironmentVariableNames?: boolean;
800
841
  /**
801
842
  * Specifies additional names for this parameter that are accepted but not displayed
802
843
  * in the command line help.
@@ -1014,7 +1055,7 @@ export declare interface ICommandLineStringListDefinition extends IBaseCommandLi
1014
1055
  * @public
1015
1056
  */
1016
1057
  export declare interface IRequiredCommandLineChoiceParameter<TChoice extends string = string> extends CommandLineChoiceParameter<TChoice> {
1017
- value: TChoice;
1058
+ readonly value: TChoice;
1018
1059
  }
1019
1060
 
1020
1061
  /**
@@ -1022,7 +1063,7 @@ export declare interface IRequiredCommandLineChoiceParameter<TChoice extends str
1022
1063
  * @public
1023
1064
  */
1024
1065
  export declare interface IRequiredCommandLineIntegerParameter extends CommandLineIntegerParameter {
1025
- value: number;
1066
+ readonly value: number;
1026
1067
  }
1027
1068
 
1028
1069
  /**
@@ -1030,7 +1071,7 @@ export declare interface IRequiredCommandLineIntegerParameter extends CommandLin
1030
1071
  * @public
1031
1072
  */
1032
1073
  export declare interface IRequiredCommandLineStringParameter extends CommandLineStringParameter {
1033
- value: string;
1074
+ readonly value: string;
1034
1075
  }
1035
1076
 
1036
1077
  /**
@@ -1086,6 +1127,9 @@ export declare abstract class ScopedCommandLineAction extends CommandLineAction
1086
1127
  constructor(options: ICommandLineActionOptions);
1087
1128
  /**
1088
1129
  * {@inheritDoc CommandLineParameterProvider.parameters}
1130
+ *
1131
+ * @internalremarks
1132
+ * TODO: Replace this type with `CommandLineParameter` in the next major bump.
1089
1133
  */
1090
1134
  get parameters(): ReadonlyArray<CommandLineParameter>;
1091
1135
  /* Excluded from this release type: _processParsedData */
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { DynamicCommandLineAction } from './providers/DynamicCommandLineAction';
8
8
  export { ScopedCommandLineAction } from './providers/ScopedCommandLineAction';
9
9
  export { AliasCommandLineAction, type IAliasCommandLineActionOptions } from './providers/AliasCommandLineAction';
10
10
  export type { IBaseCommandLineDefinition, IBaseCommandLineDefinitionWithArgument, ICommandLineFlagDefinition, ICommandLineStringDefinition, ICommandLineStringListDefinition, ICommandLineIntegerDefinition, ICommandLineIntegerListDefinition, ICommandLineChoiceDefinition, ICommandLineChoiceListDefinition, ICommandLineRemainderDefinition } from './parameters/CommandLineDefinition';
11
- export { CommandLineParameterKind, CommandLineParameter, CommandLineParameterWithArgument } from './parameters/BaseClasses';
11
+ export { CommandLineParameterKind, CommandLineParameterBase as CommandLineParameter, CommandLineParameterWithArgument } from './parameters/BaseClasses';
12
12
  export { CommandLineFlagParameter } from './parameters/CommandLineFlagParameter';
13
13
  export { CommandLineStringParameter, type IRequiredCommandLineStringParameter } from './parameters/CommandLineStringParameter';
14
14
  export { CommandLineStringListParameter } from './parameters/CommandLineStringListParameter';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EACL,sBAAsB,EACtB,KAAK,8BAA8B,EACpC,MAAM,oCAAoC,CAAC;AAE5C,YAAY,EACV,0BAA0B,EAC1B,sCAAsC,EACtC,0BAA0B,EAC1B,4B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AO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
package/lib/index.js CHANGED
@@ -18,7 +18,8 @@ var AliasCommandLineAction_1 = require("./providers/AliasCommandLineAction");
18
18
  Object.defineProperty(exports, "AliasCommandLineAction", { enumerable: true, get: function () { return AliasCommandLineAction_1.AliasCommandLineAction; } });
19
19
  var BaseClasses_1 = require("./parameters/BaseClasses");
20
20
  Object.defineProperty(exports, "CommandLineParameterKind", { enumerable: true, get: function () { return BaseClasses_1.CommandLineParameterKind; } });
21
- Object.defineProperty(exports, "CommandLineParameter", { enumerable: true, get: function () { return BaseClasses_1.CommandLineParameter; } });
21
+ // TODO: Export both `CommandLineParameter` and `CommandLineParameterBase` in the next major bump
22
+ Object.defineProperty(exports, "CommandLineParameter", { enumerable: true, get: function () { return BaseClasses_1.CommandLineParameterBase; } });
22
23
  Object.defineProperty(exports, "CommandLineParameterWithArgument", { enumerable: true, get: function () { return BaseClasses_1.CommandLineParameterWithArgument; } });
23
24
  var CommandLineFlagParameter_1 = require("./parameters/CommandLineFlagParameter");
24
25
  Object.defineProperty(exports, "CommandLineFlagParameter", { enumerable: true, get: function () { return CommandLineFlagParameter_1.CommandLineFlagParameter; } });
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;GAIG;AAEH,mEAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,iFAAgF;AAAvE,oIAAA,wBAAwB,OAAA;AACjC,+EAA8E;AAArE,kIAAA,uBAAuB,OAAA;AAChC,6EAG4C;AAF1C,gIAAA,sBAAsB,OAAA;AAiBxB,wDAIkC;AAHhC,uHAAA,wBAAwB,OAAA;AACxB,mHAAA,oBAAoB,OAAA;AACpB,+HAAA,gCAAgC,OAAA;AAGlC,kFAAiF;AAAxE,oIAAA,wBAAwB,OAAA;AACjC,sFAGiD;AAF/C,wIAAA,0BAA0B,OAAA;AAG5B,8FAA6F;AAApF,gJAAA,8BAA8B,OAAA;AACvC,wFAGkD;AAFhD,0IAAA,2BAA2B,OAAA;AAG7B,gGAA+F;AAAtF,kJAAA,+BAA+B,OAAA;AACxC,sFAGiD;AAF/C,wIAAA,0BAA0B,OAAA;AAG5B,8FAA6F;AAApF,gJAAA,8BAA8B,OAAA;AACvC,0EAAyE;AAAhE,4HAAA,oBAAoB,OAAA;AAE7B,yFAKkD;AAJhD,4IAAA,4BAA4B,OAAA;AAM9B,mEAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,iFAAgF;AAAvE,oIAAA,wBAAwB,OAAA;AAIjC,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * An object-oriented command-line parser for TypeScript projects.\n *\n * @packageDocumentation\n */\n\nexport { CommandLineAction, type ICommandLineActionOptions } from './providers/CommandLineAction';\nexport { DynamicCommandLineAction } from './providers/DynamicCommandLineAction';\nexport { ScopedCommandLineAction } from './providers/ScopedCommandLineAction';\nexport {\n AliasCommandLineAction,\n type IAliasCommandLineActionOptions\n} from './providers/AliasCommandLineAction';\n\nexport type {\n IBaseCommandLineDefinition,\n IBaseCommandLineDefinitionWithArgument,\n ICommandLineFlagDefinition,\n ICommandLineStringDefinition,\n ICommandLineStringListDefinition,\n ICommandLineIntegerDefinition,\n ICommandLineIntegerListDefinition,\n ICommandLineChoiceDefinition,\n ICommandLineChoiceListDefinition,\n ICommandLineRemainderDefinition\n} from './parameters/CommandLineDefinition';\n\nexport {\n CommandLineParameterKind,\n CommandLineParameter,\n CommandLineParameterWithArgument\n} from './parameters/BaseClasses';\n\nexport { CommandLineFlagParameter } from './parameters/CommandLineFlagParameter';\nexport {\n CommandLineStringParameter,\n type IRequiredCommandLineStringParameter\n} from './parameters/CommandLineStringParameter';\nexport { CommandLineStringListParameter } from './parameters/CommandLineStringListParameter';\nexport {\n CommandLineIntegerParameter,\n type IRequiredCommandLineIntegerParameter\n} from './parameters/CommandLineIntegerParameter';\nexport { CommandLineIntegerListParameter } from './parameters/CommandLineIntegerListParameter';\nexport {\n CommandLineChoiceParameter,\n type IRequiredCommandLineChoiceParameter\n} from './parameters/CommandLineChoiceParameter';\nexport { CommandLineChoiceListParameter } from './parameters/CommandLineChoiceListParameter';\nexport { CommandLineRemainder } from './parameters/CommandLineRemainder';\n\nexport {\n CommandLineParameterProvider,\n type IScopedLongNameParseResult,\n type ICommandLineParserData as _ICommandLineParserData,\n type IRegisterDefinedParametersState as _IRegisterDefinedParametersState\n} from './providers/CommandLineParameterProvider';\n\nexport { CommandLineParser, type ICommandLineParserOptions } from './providers/CommandLineParser';\nexport { DynamicCommandLineParser } from './providers/DynamicCommandLineParser';\n\nexport { CommandLineConstants } from './Constants';\n\nexport { CommandLineHelper } from './CommandLineHelper';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;GAIG;AAEH,mEAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,iFAAgF;AAAvE,oIAAA,wBAAwB,OAAA;AACjC,+EAA8E;AAArE,kIAAA,uBAAuB,OAAA;AAChC,6EAG4C;AAF1C,gIAAA,sBAAsB,OAAA;AAiBxB,wDAKkC;AAJhC,uHAAA,wBAAwB,OAAA;AACxB,iGAAiG;AACjG,mHAAA,wBAAwB,OAAwB;AAChD,+HAAA,gCAAgC,OAAA;AAGlC,kFAAiF;AAAxE,oIAAA,wBAAwB,OAAA;AACjC,sFAGiD;AAF/C,wIAAA,0BAA0B,OAAA;AAG5B,8FAA6F;AAApF,gJAAA,8BAA8B,OAAA;AACvC,wFAGkD;AAFhD,0IAAA,2BAA2B,OAAA;AAG7B,gGAA+F;AAAtF,kJAAA,+BAA+B,OAAA;AACxC,sFAGiD;AAF/C,wIAAA,0BAA0B,OAAA;AAG5B,8FAA6F;AAApF,gJAAA,8BAA8B,OAAA;AACvC,0EAAyE;AAAhE,4HAAA,oBAAoB,OAAA;AAE7B,yFAKkD;AAJhD,4IAAA,4BAA4B,OAAA;AAM9B,mEAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,iFAAgF;AAAvE,oIAAA,wBAAwB,OAAA;AAIjC,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * An object-oriented command-line parser for TypeScript projects.\n *\n * @packageDocumentation\n */\n\nexport { CommandLineAction, type ICommandLineActionOptions } from './providers/CommandLineAction';\nexport { DynamicCommandLineAction } from './providers/DynamicCommandLineAction';\nexport { ScopedCommandLineAction } from './providers/ScopedCommandLineAction';\nexport {\n AliasCommandLineAction,\n type IAliasCommandLineActionOptions\n} from './providers/AliasCommandLineAction';\n\nexport type {\n IBaseCommandLineDefinition,\n IBaseCommandLineDefinitionWithArgument,\n ICommandLineFlagDefinition,\n ICommandLineStringDefinition,\n ICommandLineStringListDefinition,\n ICommandLineIntegerDefinition,\n ICommandLineIntegerListDefinition,\n ICommandLineChoiceDefinition,\n ICommandLineChoiceListDefinition,\n ICommandLineRemainderDefinition\n} from './parameters/CommandLineDefinition';\n\nexport {\n CommandLineParameterKind,\n // TODO: Export both `CommandLineParameter` and `CommandLineParameterBase` in the next major bump\n CommandLineParameterBase as CommandLineParameter,\n CommandLineParameterWithArgument\n} from './parameters/BaseClasses';\n\nexport { CommandLineFlagParameter } from './parameters/CommandLineFlagParameter';\nexport {\n CommandLineStringParameter,\n type IRequiredCommandLineStringParameter\n} from './parameters/CommandLineStringParameter';\nexport { CommandLineStringListParameter } from './parameters/CommandLineStringListParameter';\nexport {\n CommandLineIntegerParameter,\n type IRequiredCommandLineIntegerParameter\n} from './parameters/CommandLineIntegerParameter';\nexport { CommandLineIntegerListParameter } from './parameters/CommandLineIntegerListParameter';\nexport {\n CommandLineChoiceParameter,\n type IRequiredCommandLineChoiceParameter\n} from './parameters/CommandLineChoiceParameter';\nexport { CommandLineChoiceListParameter } from './parameters/CommandLineChoiceListParameter';\nexport { CommandLineRemainder } from './parameters/CommandLineRemainder';\n\nexport {\n CommandLineParameterProvider,\n type IScopedLongNameParseResult,\n type ICommandLineParserData as _ICommandLineParserData,\n type IRegisterDefinedParametersState as _IRegisterDefinedParametersState\n} from './providers/CommandLineParameterProvider';\n\nexport { CommandLineParser, type ICommandLineParserOptions } from './providers/CommandLineParser';\nexport { DynamicCommandLineParser } from './providers/DynamicCommandLineParser';\n\nexport { CommandLineConstants } from './Constants';\n\nexport { CommandLineHelper } from './CommandLineHelper';\n"]}
@@ -1,5 +1,12 @@
1
1
  import type { SCOPING_PARAMETER_GROUP } from '../Constants';
2
2
  import type { IBaseCommandLineDefinition, IBaseCommandLineDefinitionWithArgument } from './CommandLineDefinition';
3
+ import type { CommandLineChoiceListParameter } from './CommandLineChoiceListParameter';
4
+ import type { CommandLineChoiceParameter } from './CommandLineChoiceParameter';
5
+ import type { CommandLineFlagParameter } from './CommandLineFlagParameter';
6
+ import type { CommandLineIntegerListParameter } from './CommandLineIntegerListParameter';
7
+ import type { CommandLineIntegerParameter } from './CommandLineIntegerParameter';
8
+ import type { CommandLineStringListParameter } from './CommandLineStringListParameter';
9
+ import type { CommandLineStringParameter } from './CommandLineStringParameter';
3
10
  /**
4
11
  * Identifies the kind of a CommandLineParameter.
5
12
  * @public
@@ -20,17 +27,30 @@ export declare enum CommandLineParameterKind {
20
27
  /** Indicates a CommandLineIntegerListParameter */
21
28
  IntegerList = 6
22
29
  }
30
+ export type CommandLineParameter = CommandLineChoiceListParameter | CommandLineChoiceParameter | CommandLineFlagParameter | CommandLineIntegerListParameter | CommandLineIntegerParameter | CommandLineStringListParameter | CommandLineStringParameter;
23
31
  /**
24
32
  * The base class for the various command-line parameter types.
25
33
  * @public
26
34
  */
27
- export declare abstract class CommandLineParameter {
35
+ export declare abstract class CommandLineParameterBase {
28
36
  private _shortNameValue;
29
37
  /**
30
38
  * A unique internal key used to retrieve the value from the parser's dictionary.
31
39
  * @internal
32
40
  */
33
41
  _parserKey: string | undefined;
42
+ /**
43
+ * @internal
44
+ */
45
+ _preParse?: () => void;
46
+ /**
47
+ * @internal
48
+ */
49
+ _postParse?: () => void;
50
+ /**
51
+ * @internal
52
+ */
53
+ _validateValue?: () => void;
34
54
  /** {@inheritDoc IBaseCommandLineDefinition.parameterLongName} */
35
55
  readonly longName: string;
36
56
  /**
@@ -48,6 +68,8 @@ export declare abstract class CommandLineParameter {
48
68
  readonly required: boolean;
49
69
  /** {@inheritDoc IBaseCommandLineDefinition.environmentVariable} */
50
70
  readonly environmentVariable: string | undefined;
71
+ /** {@inheritDoc IBaseCommandLineDefinition.allowNonStandardEnvironmentVariableNames} */
72
+ readonly allowNonStandardEnvironmentVariableNames: boolean | undefined;
51
73
  /** {@inheritDoc IBaseCommandLineDefinition.undocumentedSynonyms } */
52
74
  readonly undocumentedSynonyms: string[] | undefined;
53
75
  /** @internal */
@@ -58,7 +80,7 @@ export declare abstract class CommandLineParameter {
58
80
  * Called internally by CommandLineParameterProvider._processParsedData()
59
81
  * @internal
60
82
  */
61
- abstract _setValue(data: any): void;
83
+ abstract _setValue(data: unknown): void;
62
84
  /**
63
85
  * Returns additional text used by the help formatter.
64
86
  * @internal
@@ -85,7 +107,7 @@ export declare abstract class CommandLineParameter {
85
107
  /**
86
108
  * Internal usage only. Used to report unexpected output from the argparse library.
87
109
  */
88
- protected reportInvalidData(data: any): never;
110
+ protected reportInvalidData(data: unknown): never;
89
111
  protected validateDefaultValue(hasDefaultValue: boolean): void;
90
112
  }
91
113
  /**
@@ -96,7 +118,7 @@ export declare abstract class CommandLineParameter {
96
118
  * example "--max-count 123".
97
119
  * @public
98
120
  */
99
- export declare abstract class CommandLineParameterWithArgument extends CommandLineParameter {
121
+ export declare abstract class CommandLineParameterWithArgument extends CommandLineParameterBase {
100
122
  private static _invalidArgumentNameRegExp;
101
123
  /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.argumentName} */
102
124
  readonly argumentName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseClasses.d.ts","sourceRoot":"","sources":["../../src/parameters/BaseClasses.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EACV,0BAA0B,EAC1B,sCAAsC,EACvC,MAAM,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,oBAAY,wBAAwB;IAClC,6CAA6C;IAC7C,MAAM,IAAA;IACN,2CAA2C;IAC3C,IAAI,IAAA;IACJ,8CAA8C;IAC9C,OAAO,IAAA;IACP,6CAA6C;IAC7C,MAAM,IAAA;IACN,iDAAiD;IACjD,UAAU,IAAA;IACV,iDAAiD;IACjD,UAAU,IAAA;IACV,kDAAkD;IAClD,WAAW,IAAA;CACZ;AA4BD;;;GAGG;AACH,8BAAsB,oBAAoB;IACxC,OAAO,CAAC,eAAe,CAAqB;IAE5C;;;OAGG;IACI,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtC,iEAAiE;IACjE,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,SAAgB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnD,8DAA8D;IAC9D,SAAgB,cAAc,EAAE,MAAM,GAAG,OAAO,uBAAuB,GAAG,SAAS,CAAC;IAEpF,8DAA8D;IAC9D,SAAgB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnD,2DAA2D;IAC3D,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC,wDAAwD;IACxD,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAElC,mEAAmE;IACnE,SAAgB,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAA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ft Corporation. All rights reserved. Licensed under the MIT license.
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.CommandLineParameterWithArgument = exports.CommandLineParameter = exports.CommandLineParameterKind = void 0;
5
+ exports.CommandLineParameterWithArgument = exports.CommandLineParameterBase = exports.CommandLineParameterKind = void 0;
6
6
  /**
7
7
  * Identifies the kind of a CommandLineParameter.
8
8
  * @public
@@ -50,7 +50,7 @@ const ENVIRONMENT_VARIABLE_NAME_REGEXP = /^[A-Z_][A-Z0-9_]*$/;
50
50
  * The base class for the various command-line parameter types.
51
51
  * @public
52
52
  */
53
- class CommandLineParameter {
53
+ class CommandLineParameterBase {
54
54
  /** @internal */
55
55
  constructor(definition) {
56
56
  this.longName = definition.parameterLongName;
@@ -81,13 +81,8 @@ class CommandLineParameter {
81
81
  this.scopedLongName = `--${this.parameterScope}:${unprefixedLongName}`;
82
82
  }
83
83
  if (this.environmentVariable) {
84
- if (this.required) {
85
- // TODO: This constraint is imposed only because argparse enforces "required" parameters, but
86
- // it does not know about ts-command-line environment variable mappings. We should fix this.
87
- throw new Error(`An "environmentVariable" cannot be specified for "${this.longName}"` +
88
- ` because it is a required parameter`);
89
- }
90
- if (!ENVIRONMENT_VARIABLE_NAME_REGEXP.test(this.environmentVariable)) {
84
+ if (!this.allowNonStandardEnvironmentVariableNames &&
85
+ !ENVIRONMENT_VARIABLE_NAME_REGEXP.test(this.environmentVariable)) {
91
86
  throw new Error(`Invalid environment variable name: "${this.environmentVariable}". The name must` +
92
87
  ` consist only of upper-case letters, numbers, and underscores. It may not start with a number.`);
93
88
  }
@@ -124,7 +119,6 @@ class CommandLineParameter {
124
119
  /**
125
120
  * Internal usage only. Used to report unexpected output from the argparse library.
126
121
  */
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
122
  reportInvalidData(data) {
129
123
  throw new Error(`Unexpected data object for parameter "${this.longName}": ` + JSON.stringify(data));
130
124
  }
@@ -139,7 +133,7 @@ class CommandLineParameter {
139
133
  }
140
134
  }
141
135
  }
142
- exports.CommandLineParameter = CommandLineParameter;
136
+ exports.CommandLineParameterBase = CommandLineParameterBase;
143
137
  /**
144
138
  * The common base class for parameters types that receive an argument.
145
139
  *
@@ -148,7 +142,7 @@ exports.CommandLineParameter = CommandLineParameter;
148
142
  * example "--max-count 123".
149
143
  * @public
150
144
  */
151
- class CommandLineParameterWithArgument extends CommandLineParameter {
145
+ class CommandLineParameterWithArgument extends CommandLineParameterBase {
152
146
  /** @internal */
153
147
  constructor(definition) {
154
148
  super(definition);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseClasses.js","sourceRoot":"","sources":["../../src/parameters/BaseClasses.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAQ3D;;;GAGG;AACH,IAAY,wBAeX;AAfD,WAAY,wBAAwB;IAClC,6CAA6C;IAC7C,2EAAM,CAAA;IACN,2CAA2C;IAC3C,uEAAI,CAAA;IACJ,8CAA8C;IAC9C,6EAAO,CAAA;IACP,6CAA6C;IAC7C,2EAAM,CAAA;IACN,iDAAiD;IACjD,mFAAU,CAAA;IACV,iDAAiD;IACjD,mFAAU,CAAA;IACV,kDAAkD;IAClD,qFAAW,CAAA;AACb,CAAC,EAfW,wBAAwB,wCAAxB,wBAAwB,QAenC;AAED;;;GAGG;AACH,MAAM,gBAAgB,GAAW,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,MAAM,iBAAiB,GAAW,aAAa,CAAC;AAEhD;;;GAGG;AACH,MAAM,YAAY,GAAW,0BAA0B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,gCAAgC,GAAW,oBAAoB,CAAC;AAEtE;;;GAGG;AACH,MAAsB,oBAAoB;IAoCxC,gBAAgB;IAChB,YAAmB,UAAsC;QACvD,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,iBAAiB,CAAC;QAC7C,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,kBAAkB,CAAC;QACrD,IAAI,C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AnCH,4EAoCC;AAnCC,oGAAoG;AACrF,2DAA0B,GAAW,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { SCOPING_PARAMETER_GROUP } from '../Constants';\nimport type {\n IBaseCommandLineDefinition,\n IBaseCommandLineDefinitionWithArgument\n} from './CommandLineDefinition';\n\n/**\n * Identifies the kind of a CommandLineParameter.\n * @public\n */\nexport enum CommandLineParameterKind {\n /** Indicates a CommandLineChoiceParameter */\n Choice,\n /** Indicates a CommandLineFlagParameter */\n Flag,\n /** Indicates a CommandLineIntegerParameter */\n Integer,\n /** Indicates a CommandLineStringParameter */\n String,\n /** Indicates a CommandLineStringListParameter */\n StringList,\n /** Indicates a CommandLineChoiceListParameter */\n ChoiceList,\n /** Indicates a CommandLineIntegerListParameter */\n IntegerList\n}\n\n/**\n * Matches kebab-case formatted strings prefixed with double dashes.\n * Example: \"--do-something\"\n */\nconst LONG_NAME_REGEXP: RegExp = /^-(-[a-z0-9]+)+$/;\n\n/**\n * Matches a single upper-case or lower-case letter prefixed with a dash.\n * Example: \"-d\"\n */\nconst SHORT_NAME_REGEXP: RegExp = /^-[a-zA-Z]$/;\n\n/**\n * Matches kebab-case formatted strings\n * Example: \"my-scope\"\n */\nconst SCOPE_REGEXP: RegExp = /^[a-z0-9]+(-[a-z0-9]+)*$/;\n\n/**\n * \"Environment variable names used by the utilities in the Shell and Utilities volume of\n * IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore)\n * from the characters defined in Portable Character Set and do not begin with a digit.\"\n * Example: \"THE_SETTING\"\n */\nconst ENVIRONMENT_VARIABLE_NAME_REGEXP: RegExp = /^[A-Z_][A-Z0-9_]*$/;\n\n/**\n * The base class for the various command-line parameter types.\n * @public\n */\nexport abstract class CommandLineParameter {\n private _shortNameValue: string | undefined;\n\n /**\n * A unique internal key used to retrieve the value from the parser's dictionary.\n * @internal\n */\n public _parserKey: string | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterLongName} */\n public readonly longName: string;\n\n /**\n * If a parameterScope is provided, returns the scope-prefixed long name of the flag,\n * including double dashes, eg. \"--scope:do-something\". Otherwise undefined.\n */\n public readonly scopedLongName: string | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterGroup} */\n public readonly parameterGroup: string | typeof SCOPING_PARAMETER_GROUP | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterScope} */\n public readonly parameterScope: string | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.description} */\n public readonly description: string;\n\n /** {@inheritDoc IBaseCommandLineDefinition.required} */\n public readonly required: boolean;\n\n /** {@inheritDoc IBaseCommandLineDefinition.environmentVariable} */\n public readonly environmentVariable: string | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.undocumentedSynonyms } */\n public readonly undocumentedSynonyms: string[] | undefined;\n\n /** @internal */\n public constructor(definition: IBaseCommandLineDefinition) {\n this.longName = definition.parameterLongName;\n this._shortNameValue = definition.parameterShortName;\n this.parameterGroup = definition.parameterGroup;\n this.parameterScope = definition.parameterScope;\n this.description = definition.description;\n this.required = !!definition.required;\n this.environmentVariable = definition.environmentVariable;\n this.undocumentedSynonyms = definition.undocumentedSynonyms;\n\n if (!LONG_NAME_REGEXP.test(this.longName)) {\n throw new Error(\n `Invalid name: \"${this.longName}\". The parameter long name must be` +\n ` lower-case and use dash delimiters (e.g. \"--do-a-thing\")`\n );\n }\n\n if (this.shortName) {\n if (!SHORT_NAME_REGEXP.test(this.shortName)) {\n throw new Error(\n `Invalid name: \"${this.shortName}\". The parameter short name must be` +\n ` a dash followed by a single upper-case or lower-case letter (e.g. \"-a\")`\n );\n }\n }\n\n if (this.parameterScope) {\n if (!SCOPE_REGEXP.test(this.parameterScope)) {\n throw new Error(\n `Invalid scope: \"${this.parameterScope}\". The parameter scope name must be` +\n ` lower-case and use dash delimiters (e.g. \"my-scope\")`\n );\n }\n // Parameter long name is guaranteed to start with '--' since this is validated above\n const unprefixedLongName: string = this.longName.slice(2);\n this.scopedLongName = `--${this.parameterScope}:${unprefixedLongName}`;\n }\n\n if (this.environmentVariable) {\n if (this.required) {\n // TODO: This constraint is imposed only because argparse enforces \"required\" parameters, but\n // it does not know about ts-command-line environment variable mappings. We should fix this.\n throw new Error(\n `An \"environmentVariable\" cannot be specified for \"${this.longName}\"` +\n ` because it is a required parameter`\n );\n }\n\n if (!ENVIRONMENT_VARIABLE_NAME_REGEXP.test(this.environmentVariable)) {\n throw new Error(\n `Invalid environment variable name: \"${this.environmentVariable}\". The name must` +\n ` consist only of upper-case letters, numbers, and underscores. It may not start with a number.`\n );\n }\n }\n\n if (this.undocumentedSynonyms && this.undocumentedSynonyms.length > 0) {\n for (const undocumentedSynonym of this.undocumentedSynonyms) {\n if (this.longName === undocumentedSynonym) {\n throw new Error(\n `Invalid name: \"${undocumentedSynonym}\". Undocumented synonyms must not be the same` +\n ` as the the long name.`\n );\n } else if (!LONG_NAME_REGEXP.test(undocumentedSynonym)) {\n throw new Error(\n `Invalid name: \"${undocumentedSynonym}\". All undocumented synonyms name must be lower-case and ` +\n 'use dash delimiters (e.g. \"--do-a-thing\")'\n );\n }\n }\n }\n }\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterShortName} */\n public get shortName(): string | undefined {\n return this._shortNameValue;\n }\n\n /**\n * Called internally by CommandLineParameterProvider._processParsedData()\n * @internal\n */\n public abstract _setValue(data: any): void; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n /**\n * Returns additional text used by the help formatter.\n * @internal\n */\n public _getSupplementaryNotes(supplementaryNotes: string[]): void {\n // virtual\n if (this.environmentVariable !== undefined) {\n supplementaryNotes.push(\n 'This parameter may alternatively be specified via the ' +\n this.environmentVariable +\n ' environment variable.'\n );\n }\n }\n\n /**\n * Indicates the type of parameter.\n */\n public abstract get kind(): CommandLineParameterKind;\n\n /**\n * Append the parsed values to the provided string array.\n * @remarks\n * Sometimes a command line parameter is not used directly, but instead gets passed through to another\n * tool that will use it. For example if our parameter comes in as \"--max-count 3\", then we might want to\n * call `child_process.spawn()` and append [\"--max-count\", \"3\"] to the args array for that tool.\n * appendToArgList() appends zero or more strings to the provided array, based on the input command-line\n * that we parsed.\n *\n * If the parameter was omitted from our command-line and has no default value, then\n * nothing will be appended. If the short name was used, the long name will be appended instead.\n * @param argList - the parsed strings will be appended to this string array\n */\n public abstract appendToArgList(argList: string[]): void;\n\n /**\n * Internal usage only. Used to report unexpected output from the argparse library.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected reportInvalidData(data: any): never {\n throw new Error(`Unexpected data object for parameter \"${this.longName}\": ` + JSON.stringify(data));\n }\n\n protected validateDefaultValue(hasDefaultValue: boolean): void {\n if (this.required && hasDefaultValue) {\n // If a parameter is \"required\", then the user understands that they always need to\n // specify a value for this parameter (either via the command line or via an environment variable).\n // It would be confusing to allow a default value that sometimes allows the \"required\" parameter\n // to be omitted. If you sometimes don't have a suitable default value, then the better approach\n // is to throw a custom error explaining why the parameter is required in that case.\n throw new Error(\n `A default value cannot be specified for \"${this.longName}\" because it is a \"required\" parameter`\n );\n }\n }\n}\n\n/**\n * The common base class for parameters types that receive an argument.\n *\n * @remarks\n * An argument is an accompanying command-line token, such as \"123\" in the\n * example \"--max-count 123\".\n * @public\n */\nexport abstract class CommandLineParameterWithArgument extends CommandLineParameter {\n // Matches the first character that *isn't* part of a valid upper-case argument name such as \"URL_2\"\n private static _invalidArgumentNameRegExp: RegExp = /[^A-Z_0-9]/;\n\n /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.argumentName} */\n public readonly argumentName: string;\n\n /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.completions} */\n public readonly completions: (() => Promise<string[]>) | undefined;\n\n /** @internal */\n public constructor(definition: IBaseCommandLineDefinitionWithArgument) {\n super(definition);\n\n if (definition.argumentName === '') {\n throw new Error(\n 'The argument name cannot be an empty string. (For the default name, specify undefined.)'\n );\n }\n if (definition.argumentName.toUpperCase() !== definition.argumentName) {\n throw new Error(\n `Invalid name: \"${definition.argumentName}\". The argument name must be all upper case.`\n );\n }\n const match: RegExpMatchArray | null = definition.argumentName.match(\n CommandLineParameterWithArgument._invalidArgumentNameRegExp\n );\n if (match) {\n throw new Error(\n `The argument name \"${definition.argumentName}\" contains an invalid character \"${match[0]}\".` +\n ` Only upper-case letters, numbers, and underscores are allowed.`\n );\n }\n this.argumentName = definition.argumentName;\n this.completions = definition.completions;\n }\n}\n"]}
1
+ {"version":3,"file":"BaseClasses.js","sourceRoot":"","sources":["../../src/parameters/BaseClasses.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAe3D;;;GAGG;AACH,IAAY,wBAeX;AAfD,WAAY,wBAAwB;IAClC,6CAA6C;IAC7C,2EAAM,CAAA;IACN,2CAA2C;IAC3C,uEAAI,CAAA;IACJ,8CAA8C;IAC9C,6EAAO,CAAA;IACP,6CAA6C;IAC7C,2EAAM,CAAA;IACN,iDAAiD;IACjD,mFAAU,CAAA;IACV,iDAAiD;IACjD,mFAAU,CAAA;IACV,kDAAkD;IAClD,qFAAW,CAAA;AACb,CAAC,EAfW,wBAAwB,wCAAxB,wBAAwB,QAenC;AAED;;;GAGG;AACH,MAAM,gBAAgB,GAAW,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,MAAM,iBAAiB,GAAW,aAAa,CAAC;AAEhD;;;GAGG;AACH,MAAM,YAAY,GAAW,0BAA0B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,gCAAgC,GAAW,oBAAoB,CAAC;AAWtE;;;GAGG;AACH,MAAsB,wBAAwB;IAsD5C,gBAAgB;IAChB,YAAmB,UAAsC;QACvD,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,iBAAiB,CAAC;QAC7C,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI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AAQ,IAAI,eAAe,EAAE,CAAC;YACrC,mFAAmF;YACnF,mGAAmG;YACnG,gGAAgG;YAChG,iGAAiG;YACjG,oFAAoF;YACpF,MAAM,IAAI,KAAK,CACb,4CAA4C,IAAI,CAAC,QAAQ,wCAAwC,CAClG,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA3LD,4DA2LC;AAED;;;;;;;GAOG;AACH,MAAsB,gCAAiC,SAAQ,wBAAwB;IAUrF,gBAAgB;IAChB,YAAmB,UAAkD;QACnE,KAAK,CAAC,UAAU,CAAC,CAAC;QAElB,IAAI,UAAU,CAAC,YAAY,KAAK,EAAE,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;QACJ,CAAC;QACD,IAAI,UAAU,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,YAAY,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CACb,kBAAkB,UAAU,CAAC,YAAY,8CAA8C,CACxF,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAA4B,UAAU,CAAC,YAAY,CAAC,KAAK,CAClE,gCAAgC,CAAC,0BAA0B,CAC5D,CAAC;QACF,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CACb,sBAAsB,UAAU,CAAC,YAAY,oCAAoC,KAAK,CAAC,CAAC,CAAC,IAAI;gBAC3F,iEAAiE,CACpE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IAC5C,CAAC;;AAnCH,4EAoCC;AAnCC,oGAAoG;AACrF,2DAA0B,GAAW,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { SCOPING_PARAMETER_GROUP } from '../Constants';\nimport type {\n IBaseCommandLineDefinition,\n IBaseCommandLineDefinitionWithArgument\n} from './CommandLineDefinition';\nimport type { CommandLineChoiceListParameter } from './CommandLineChoiceListParameter';\nimport type { CommandLineChoiceParameter } from './CommandLineChoiceParameter';\nimport type { CommandLineFlagParameter } from './CommandLineFlagParameter';\nimport type { CommandLineIntegerListParameter } from './CommandLineIntegerListParameter';\nimport type { CommandLineIntegerParameter } from './CommandLineIntegerParameter';\nimport type { CommandLineStringListParameter } from './CommandLineStringListParameter';\nimport type { CommandLineStringParameter } from './CommandLineStringParameter';\n\n/**\n * Identifies the kind of a CommandLineParameter.\n * @public\n */\nexport enum CommandLineParameterKind {\n /** Indicates a CommandLineChoiceParameter */\n Choice,\n /** Indicates a CommandLineFlagParameter */\n Flag,\n /** Indicates a CommandLineIntegerParameter */\n Integer,\n /** Indicates a CommandLineStringParameter */\n String,\n /** Indicates a CommandLineStringListParameter */\n StringList,\n /** Indicates a CommandLineChoiceListParameter */\n ChoiceList,\n /** Indicates a CommandLineIntegerListParameter */\n IntegerList\n}\n\n/**\n * Matches kebab-case formatted strings prefixed with double dashes.\n * Example: \"--do-something\"\n */\nconst LONG_NAME_REGEXP: RegExp = /^-(-[a-z0-9]+)+$/;\n\n/**\n * Matches a single upper-case or lower-case letter prefixed with a dash.\n * Example: \"-d\"\n */\nconst SHORT_NAME_REGEXP: RegExp = /^-[a-zA-Z]$/;\n\n/**\n * Matches kebab-case formatted strings\n * Example: \"my-scope\"\n */\nconst SCOPE_REGEXP: RegExp = /^[a-z0-9]+(-[a-z0-9]+)*$/;\n\n/**\n * \"Environment variable names used by the utilities in the Shell and Utilities volume of\n * IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore)\n * from the characters defined in Portable Character Set and do not begin with a digit.\"\n * Example: \"THE_SETTING\"\n */\nconst ENVIRONMENT_VARIABLE_NAME_REGEXP: RegExp = /^[A-Z_][A-Z0-9_]*$/;\n\nexport type CommandLineParameter =\n | CommandLineChoiceListParameter\n | CommandLineChoiceParameter\n | CommandLineFlagParameter\n | CommandLineIntegerListParameter\n | CommandLineIntegerParameter\n | CommandLineStringListParameter\n | CommandLineStringParameter;\n\n/**\n * The base class for the various command-line parameter types.\n * @public\n */\nexport abstract class CommandLineParameterBase {\n private _shortNameValue: string | undefined;\n\n /**\n * A unique internal key used to retrieve the value from the parser's dictionary.\n * @internal\n */\n public _parserKey: string | undefined;\n\n /**\n * @internal\n */\n public _preParse?: () => void;\n\n /**\n * @internal\n */\n public _postParse?: () => void;\n\n /**\n * @internal\n */\n public _validateValue?: () => void;\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterLongName} */\n public readonly longName: string;\n\n /**\n * If a parameterScope is provided, returns the scope-prefixed long name of the flag,\n * including double dashes, eg. \"--scope:do-something\". Otherwise undefined.\n */\n public readonly scopedLongName: string | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterGroup} */\n public readonly parameterGroup: string | typeof SCOPING_PARAMETER_GROUP | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterScope} */\n public readonly parameterScope: string | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.description} */\n public readonly description: string;\n\n /** {@inheritDoc IBaseCommandLineDefinition.required} */\n public readonly required: boolean;\n\n /** {@inheritDoc IBaseCommandLineDefinition.environmentVariable} */\n public readonly environmentVariable: string | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.allowNonStandardEnvironmentVariableNames} */\n public readonly allowNonStandardEnvironmentVariableNames: boolean | undefined;\n\n /** {@inheritDoc IBaseCommandLineDefinition.undocumentedSynonyms } */\n public readonly undocumentedSynonyms: string[] | undefined;\n\n /** @internal */\n public constructor(definition: IBaseCommandLineDefinition) {\n this.longName = definition.parameterLongName;\n this._shortNameValue = definition.parameterShortName;\n this.parameterGroup = definition.parameterGroup;\n this.parameterScope = definition.parameterScope;\n this.description = definition.description;\n this.required = !!definition.required;\n this.environmentVariable = definition.environmentVariable;\n this.undocumentedSynonyms = definition.undocumentedSynonyms;\n\n if (!LONG_NAME_REGEXP.test(this.longName)) {\n throw new Error(\n `Invalid name: \"${this.longName}\". The parameter long name must be` +\n ` lower-case and use dash delimiters (e.g. \"--do-a-thing\")`\n );\n }\n\n if (this.shortName) {\n if (!SHORT_NAME_REGEXP.test(this.shortName)) {\n throw new Error(\n `Invalid name: \"${this.shortName}\". The parameter short name must be` +\n ` a dash followed by a single upper-case or lower-case letter (e.g. \"-a\")`\n );\n }\n }\n\n if (this.parameterScope) {\n if (!SCOPE_REGEXP.test(this.parameterScope)) {\n throw new Error(\n `Invalid scope: \"${this.parameterScope}\". The parameter scope name must be` +\n ` lower-case and use dash delimiters (e.g. \"my-scope\")`\n );\n }\n // Parameter long name is guaranteed to start with '--' since this is validated above\n const unprefixedLongName: string = this.longName.slice(2);\n this.scopedLongName = `--${this.parameterScope}:${unprefixedLongName}`;\n }\n\n if (this.environmentVariable) {\n if (\n !this.allowNonStandardEnvironmentVariableNames &&\n !ENVIRONMENT_VARIABLE_NAME_REGEXP.test(this.environmentVariable)\n ) {\n throw new Error(\n `Invalid environment variable name: \"${this.environmentVariable}\". The name must` +\n ` consist only of upper-case letters, numbers, and underscores. It may not start with a number.`\n );\n }\n }\n\n if (this.undocumentedSynonyms && this.undocumentedSynonyms.length > 0) {\n for (const undocumentedSynonym of this.undocumentedSynonyms) {\n if (this.longName === undocumentedSynonym) {\n throw new Error(\n `Invalid name: \"${undocumentedSynonym}\". Undocumented synonyms must not be the same` +\n ` as the the long name.`\n );\n } else if (!LONG_NAME_REGEXP.test(undocumentedSynonym)) {\n throw new Error(\n `Invalid name: \"${undocumentedSynonym}\". All undocumented synonyms name must be lower-case and ` +\n 'use dash delimiters (e.g. \"--do-a-thing\")'\n );\n }\n }\n }\n }\n\n /** {@inheritDoc IBaseCommandLineDefinition.parameterShortName} */\n public get shortName(): string | undefined {\n return this._shortNameValue;\n }\n\n /**\n * Called internally by CommandLineParameterProvider._processParsedData()\n * @internal\n */\n public abstract _setValue(data: unknown): void;\n\n /**\n * Returns additional text used by the help formatter.\n * @internal\n */\n public _getSupplementaryNotes(supplementaryNotes: string[]): void {\n // virtual\n if (this.environmentVariable !== undefined) {\n supplementaryNotes.push(\n 'This parameter may alternatively be specified via the ' +\n this.environmentVariable +\n ' environment variable.'\n );\n }\n }\n\n /**\n * Indicates the type of parameter.\n */\n public abstract get kind(): CommandLineParameterKind;\n\n /**\n * Append the parsed values to the provided string array.\n * @remarks\n * Sometimes a command line parameter is not used directly, but instead gets passed through to another\n * tool that will use it. For example if our parameter comes in as \"--max-count 3\", then we might want to\n * call `child_process.spawn()` and append [\"--max-count\", \"3\"] to the args array for that tool.\n * appendToArgList() appends zero or more strings to the provided array, based on the input command-line\n * that we parsed.\n *\n * If the parameter was omitted from our command-line and has no default value, then\n * nothing will be appended. If the short name was used, the long name will be appended instead.\n * @param argList - the parsed strings will be appended to this string array\n */\n public abstract appendToArgList(argList: string[]): void;\n\n /**\n * Internal usage only. Used to report unexpected output from the argparse library.\n */\n protected reportInvalidData(data: unknown): never {\n throw new Error(`Unexpected data object for parameter \"${this.longName}\": ` + JSON.stringify(data));\n }\n\n protected validateDefaultValue(hasDefaultValue: boolean): void {\n if (this.required && hasDefaultValue) {\n // If a parameter is \"required\", then the user understands that they always need to\n // specify a value for this parameter (either via the command line or via an environment variable).\n // It would be confusing to allow a default value that sometimes allows the \"required\" parameter\n // to be omitted. If you sometimes don't have a suitable default value, then the better approach\n // is to throw a custom error explaining why the parameter is required in that case.\n throw new Error(\n `A default value cannot be specified for \"${this.longName}\" because it is a \"required\" parameter`\n );\n }\n }\n}\n\n/**\n * The common base class for parameters types that receive an argument.\n *\n * @remarks\n * An argument is an accompanying command-line token, such as \"123\" in the\n * example \"--max-count 123\".\n * @public\n */\nexport abstract class CommandLineParameterWithArgument extends CommandLineParameterBase {\n // Matches the first character that *isn't* part of a valid upper-case argument name such as \"URL_2\"\n private static _invalidArgumentNameRegExp: RegExp = /[^A-Z_0-9]/;\n\n /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.argumentName} */\n public readonly argumentName: string;\n\n /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.completions} */\n public readonly completions: (() => Promise<string[]>) | undefined;\n\n /** @internal */\n public constructor(definition: IBaseCommandLineDefinitionWithArgument) {\n super(definition);\n\n if (definition.argumentName === '') {\n throw new Error(\n 'The argument name cannot be an empty string. (For the default name, specify undefined.)'\n );\n }\n if (definition.argumentName.toUpperCase() !== definition.argumentName) {\n throw new Error(\n `Invalid name: \"${definition.argumentName}\". The argument name must be all upper case.`\n );\n }\n const match: RegExpMatchArray | null = definition.argumentName.match(\n CommandLineParameterWithArgument._invalidArgumentNameRegExp\n );\n if (match) {\n throw new Error(\n `The argument name \"${definition.argumentName}\" contains an invalid character \"${match[0]}\".` +\n ` Only upper-case letters, numbers, and underscores are allowed.`\n );\n }\n this.argumentName = definition.argumentName;\n this.completions = definition.completions;\n }\n}\n"]}
@@ -1,24 +1,24 @@
1
1
  import type { ICommandLineChoiceListDefinition } from './CommandLineDefinition';
2
- import { CommandLineParameter, CommandLineParameterKind } from './BaseClasses';
2
+ import { CommandLineParameterBase, CommandLineParameterKind } from './BaseClasses';
3
3
  /**
4
4
  * The data type returned by {@link CommandLineParameterProvider.defineChoiceListParameter}.
5
5
  * @public
6
6
  */
7
- export declare class CommandLineChoiceListParameter<TChoice extends string = string> extends CommandLineParameter {
7
+ export declare class CommandLineChoiceListParameter<TChoice extends string = string> extends CommandLineParameterBase {
8
8
  /** {@inheritDoc ICommandLineChoiceListDefinition.alternatives} */
9
9
  readonly alternatives: ReadonlyArray<TChoice>;
10
10
  private _values;
11
11
  /** {@inheritDoc ICommandLineChoiceListDefinition.completions} */
12
12
  readonly completions: (() => Promise<TChoice[]>) | undefined;
13
+ /** {@inheritDoc CommandLineParameter.kind} */
14
+ readonly kind: CommandLineParameterKind.ChoiceList;
13
15
  /** @internal */
14
16
  constructor(definition: ICommandLineChoiceListDefinition<TChoice>);
15
- /** {@inheritDoc CommandLineParameter.kind} */
16
- get kind(): CommandLineParameterKind;
17
17
  /**
18
18
  * {@inheritDoc CommandLineParameter._setValue}
19
19
  * @internal
20
20
  */
21
- _setValue(data: any): void;
21
+ _setValue(data: unknown): void;
22
22
  /**
23
23
  * Returns the string arguments for a choice list parameter that was parsed from the command line.
24
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"CommandLineChoiceListParameter.d.ts","sourceRoot":"","sources":["../../src/parameters/CommandLineChoiceListParameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG/E;;;GAGG;AACH,qBAAa,8BAA8B,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,oBAAoB;IACvG,kEAAkE;IAClE,SAAgB,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAErD,OAAO,CAAC,OAAO,CAAiB;IAEhC,iEAAiE;IACjE,SAAgB,WAAW,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;IAEpE,gBAAgB;gBACG,UAAU,EAAE,gCAAgC,CAAC,OAAO,CAAC;IAaxE,8CAA8C;IAC9C,IAAW,IAAI,IAAI,wBAAwB,CAE1C;IAED;;;OAGG;IAEI,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAsCjC;;;;;;OAMG;IACH,IAAW,MAAM,IAAI,aAAa,CAAC,OAAO,CAAC,CAE1C;IAED,mEAAmE;IAC5D,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;CAQhD"}
1
+ {"version":3,"file":"CommandLineChoiceListParameter.d.ts","sourceRoot":"","sources":["../../src/parameters/CommandLineChoiceListParameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAGnF;;;GAGG;AACH,qBAAa,8BAA8B,CACzC,OAAO,SAAS,MAAM,GAAG,MAAM,CAC/B,SAAQ,wBAAwB;IAChC,kEAAkE;IAClE,SAAgB,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAErD,OAAO,CAAC,OAAO,CAAiB;IAEhC,iEAAiE;IACjE,SAAgB,WAAW,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;IAEpE,8CAA8C;IAC9C,SAAgB,IAAI,EAAE,wBAAwB,CAAC,UAAU,CAAuC;IAEhG,gBAAgB;gBACG,UAAU,EAAE,gCAAgC,CAAC,OAAO,CAAC;IAaxE;;;OAGG;IACI,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAsCrC;;;;;;OAMG;IACH,IAAW,MAAM,IAAI,aAAa,CAAC,OAAO,CAAC,CAE1C;IAED,mEAAmE;IAC5D,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;CAQhD"}
@@ -9,26 +9,23 @@ const EnvironmentVariableParser_1 = require("./EnvironmentVariableParser");
9
9
  * The data type returned by {@link CommandLineParameterProvider.defineChoiceListParameter}.
10
10
  * @public
11
11
  */
12
- class CommandLineChoiceListParameter extends BaseClasses_1.CommandLineParameter {
12
+ class CommandLineChoiceListParameter extends BaseClasses_1.CommandLineParameterBase {
13
13
  /** @internal */
14
14
  constructor(definition) {
15
15
  super(definition);
16
16
  this._values = [];
17
+ /** {@inheritDoc CommandLineParameter.kind} */
18
+ this.kind = BaseClasses_1.CommandLineParameterKind.ChoiceList;
17
19
  if (definition.alternatives.length < 1) {
18
20
  throw new Error(`When defining a choice list parameter, the alternatives list must contain at least one value.`);
19
21
  }
20
22
  this.alternatives = definition.alternatives;
21
23
  this.completions = definition.completions;
22
24
  }
23
- /** {@inheritDoc CommandLineParameter.kind} */
24
- get kind() {
25
- return BaseClasses_1.CommandLineParameterKind.ChoiceList;
26
- }
27
25
  /**
28
26
  * {@inheritDoc CommandLineParameter._setValue}
29
27
  * @internal
30
28
  */
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
29
  _setValue(data) {
33
30
  // If argparse passed us a value, confirm it is valid
34
31
  if (data !== null && data !== undefined) {