@rushstack/ts-command-line 4.9.1

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 (91) hide show
  1. package/CHANGELOG.json +1329 -0
  2. package/CHANGELOG.md +704 -0
  3. package/LICENSE +24 -0
  4. package/README.md +251 -0
  5. package/dist/ts-command-line.d.ts +878 -0
  6. package/dist/tsdoc-metadata.json +11 -0
  7. package/lib/CommandLineHelper.d.ts +14 -0
  8. package/lib/CommandLineHelper.d.ts.map +1 -0
  9. package/lib/CommandLineHelper.js +22 -0
  10. package/lib/CommandLineHelper.js.map +1 -0
  11. package/lib/Constants.d.ts +12 -0
  12. package/lib/Constants.d.ts.map +1 -0
  13. package/lib/Constants.js +5 -0
  14. package/lib/Constants.js.map +1 -0
  15. package/lib/index.d.ts +23 -0
  16. package/lib/index.d.ts.map +1 -0
  17. package/lib/index.js +42 -0
  18. package/lib/index.js.map +1 -0
  19. package/lib/parameters/BaseClasses.d.ts +100 -0
  20. package/lib/parameters/BaseClasses.d.ts.map +1 -0
  21. package/lib/parameters/BaseClasses.js +148 -0
  22. package/lib/parameters/BaseClasses.js.map +1 -0
  23. package/lib/parameters/CommandLineChoiceListParameter.d.ts +33 -0
  24. package/lib/parameters/CommandLineChoiceListParameter.d.ts.map +1 -0
  25. package/lib/parameters/CommandLineChoiceListParameter.js +84 -0
  26. package/lib/parameters/CommandLineChoiceListParameter.js.map +1 -0
  27. package/lib/parameters/CommandLineChoiceParameter.d.ts +40 -0
  28. package/lib/parameters/CommandLineChoiceParameter.d.ts.map +1 -0
  29. package/lib/parameters/CommandLineChoiceParameter.js +95 -0
  30. package/lib/parameters/CommandLineChoiceParameter.js.map +1 -0
  31. package/lib/parameters/CommandLineDefinition.d.ts +207 -0
  32. package/lib/parameters/CommandLineDefinition.d.ts.map +1 -0
  33. package/lib/parameters/CommandLineDefinition.js +5 -0
  34. package/lib/parameters/CommandLineDefinition.js.map +1 -0
  35. package/lib/parameters/CommandLineFlagParameter.d.ts +29 -0
  36. package/lib/parameters/CommandLineFlagParameter.d.ts.map +1 -0
  37. package/lib/parameters/CommandLineFlagParameter.js +72 -0
  38. package/lib/parameters/CommandLineFlagParameter.js.map +1 -0
  39. package/lib/parameters/CommandLineIntegerListParameter.d.ts +29 -0
  40. package/lib/parameters/CommandLineIntegerListParameter.d.ts.map +1 -0
  41. package/lib/parameters/CommandLineIntegerListParameter.js +82 -0
  42. package/lib/parameters/CommandLineIntegerListParameter.js.map +1 -0
  43. package/lib/parameters/CommandLineIntegerParameter.d.ts +36 -0
  44. package/lib/parameters/CommandLineIntegerParameter.d.ts.map +1 -0
  45. package/lib/parameters/CommandLineIntegerParameter.js +86 -0
  46. package/lib/parameters/CommandLineIntegerParameter.js.map +1 -0
  47. package/lib/parameters/CommandLineRemainder.d.ts +28 -0
  48. package/lib/parameters/CommandLineRemainder.d.ts.map +1 -0
  49. package/lib/parameters/CommandLineRemainder.js +48 -0
  50. package/lib/parameters/CommandLineRemainder.js.map +1 -0
  51. package/lib/parameters/CommandLineStringListParameter.d.ts +29 -0
  52. package/lib/parameters/CommandLineStringListParameter.d.ts.map +1 -0
  53. package/lib/parameters/CommandLineStringListParameter.js +73 -0
  54. package/lib/parameters/CommandLineStringListParameter.js.map +1 -0
  55. package/lib/parameters/CommandLineStringParameter.d.ts +36 -0
  56. package/lib/parameters/CommandLineStringParameter.d.ts.map +1 -0
  57. package/lib/parameters/CommandLineStringParameter.js +85 -0
  58. package/lib/parameters/CommandLineStringParameter.js.map +1 -0
  59. package/lib/parameters/EnvironmentVariableParser.d.ts +10 -0
  60. package/lib/parameters/EnvironmentVariableParser.d.ts.map +1 -0
  61. package/lib/parameters/EnvironmentVariableParser.js +51 -0
  62. package/lib/parameters/EnvironmentVariableParser.js.map +1 -0
  63. package/lib/providers/CommandLineAction.d.ts +76 -0
  64. package/lib/providers/CommandLineAction.d.ts.map +1 -0
  65. package/lib/providers/CommandLineAction.js +73 -0
  66. package/lib/providers/CommandLineAction.js.map +1 -0
  67. package/lib/providers/CommandLineParameterProvider.d.ts +202 -0
  68. package/lib/providers/CommandLineParameterProvider.d.ts.map +1 -0
  69. package/lib/providers/CommandLineParameterProvider.js +374 -0
  70. package/lib/providers/CommandLineParameterProvider.js.map +1 -0
  71. package/lib/providers/CommandLineParser.d.ts +100 -0
  72. package/lib/providers/CommandLineParser.d.ts.map +1 -0
  73. package/lib/providers/CommandLineParser.js +204 -0
  74. package/lib/providers/CommandLineParser.js.map +1 -0
  75. package/lib/providers/CommandLineParserExitError.d.ts +10 -0
  76. package/lib/providers/CommandLineParserExitError.d.ts.map +1 -0
  77. package/lib/providers/CommandLineParserExitError.js +53 -0
  78. package/lib/providers/CommandLineParserExitError.js.map +1 -0
  79. package/lib/providers/DynamicCommandLineAction.d.ts +9 -0
  80. package/lib/providers/DynamicCommandLineAction.d.ts.map +1 -0
  81. package/lib/providers/DynamicCommandLineAction.js +21 -0
  82. package/lib/providers/DynamicCommandLineAction.js.map +1 -0
  83. package/lib/providers/DynamicCommandLineParser.d.ts +8 -0
  84. package/lib/providers/DynamicCommandLineParser.d.ts.map +1 -0
  85. package/lib/providers/DynamicCommandLineParser.js +16 -0
  86. package/lib/providers/DynamicCommandLineParser.js.map +1 -0
  87. package/lib/providers/TabCompletionAction.d.ts +18 -0
  88. package/lib/providers/TabCompletionAction.d.ts.map +1 -0
  89. package/lib/providers/TabCompletionAction.js +211 -0
  90. package/lib/providers/TabCompletionAction.js.map +1 -0
  91. package/package.json +28 -0
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.18.9"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Helpers for working with the ts-command-line API.
3
+ *
4
+ * @public
5
+ */
6
+ export declare class CommandLineHelper {
7
+ /**
8
+ * Returns true if the current command line action is tab-complete.
9
+ *
10
+ * @public
11
+ */
12
+ static isTabCompletionActionRequest(argv: string[]): boolean;
13
+ }
14
+ //# sourceMappingURL=CommandLineHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLineHelper.d.ts","sourceRoot":"","sources":["../src/CommandLineHelper.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B;;;;OAIG;WACW,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO;CAGpE"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.CommandLineHelper = void 0;
6
+ /**
7
+ * Helpers for working with the ts-command-line API.
8
+ *
9
+ * @public
10
+ */
11
+ class CommandLineHelper {
12
+ /**
13
+ * Returns true if the current command line action is tab-complete.
14
+ *
15
+ * @public
16
+ */
17
+ static isTabCompletionActionRequest(argv) {
18
+ return argv && argv.length > 2 && argv[2] === "tab-complete" /* TabCompletionActionName */;
19
+ }
20
+ }
21
+ exports.CommandLineHelper = CommandLineHelper;
22
+ //# sourceMappingURL=CommandLineHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLineHelper.js","sourceRoot":"","sources":["../src/CommandLineHelper.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D;;;;GAIG;AACH,MAAa,iBAAiB;IAC5B;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAc;QACvD,OAAO,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,iDAAiD,CAAC;IAC7F,CAAC;CACF;AATD,8CASC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { CommandLineConstants } from './Constants';\r\n\r\n/**\r\n * Helpers for working with the ts-command-line API.\r\n *\r\n * @public\r\n */\r\nexport class CommandLineHelper {\r\n /**\r\n * Returns true if the current command line action is tab-complete.\r\n *\r\n * @public\r\n */\r\n public static isTabCompletionActionRequest(argv: string[]): boolean {\r\n return argv && argv.length > 2 && argv[2] === CommandLineConstants.TabCompletionActionName;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * String constants for command line processing.
3
+ *
4
+ * @public
5
+ */
6
+ export declare const enum CommandLineConstants {
7
+ /**
8
+ * The name of the built-in action that serves suggestions for tab-completion
9
+ */
10
+ TabCompletionActionName = "tab-complete"
11
+ }
12
+ //# sourceMappingURL=Constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,0BAAkB,oBAAoB;IACpC;;OAEG;IACH,uBAAuB,iBAAiB;CACzC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=Constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\n/**\r\n * String constants for command line processing.\r\n *\r\n * @public\r\n */\r\nexport const enum CommandLineConstants {\r\n /**\r\n * The name of the built-in action that serves suggestions for tab-completion\r\n */\r\n TabCompletionActionName = 'tab-complete'\r\n}\r\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * An object-oriented command-line parser for TypeScript projects.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { CommandLineAction, ICommandLineActionOptions } from './providers/CommandLineAction';
7
+ export { IBaseCommandLineDefinition, IBaseCommandLineDefinitionWithArgument, ICommandLineFlagDefinition, ICommandLineStringDefinition, ICommandLineStringListDefinition, ICommandLineIntegerDefinition, ICommandLineIntegerListDefinition, ICommandLineChoiceDefinition, ICommandLineChoiceListDefinition, ICommandLineRemainderDefinition } from './parameters/CommandLineDefinition';
8
+ export { CommandLineParameterKind, CommandLineParameter, CommandLineParameterWithArgument } from './parameters/BaseClasses';
9
+ export { CommandLineFlagParameter } from './parameters/CommandLineFlagParameter';
10
+ export { CommandLineStringParameter } from './parameters/CommandLineStringParameter';
11
+ export { CommandLineStringListParameter } from './parameters/CommandLineStringListParameter';
12
+ export { CommandLineIntegerParameter } from './parameters/CommandLineIntegerParameter';
13
+ export { CommandLineIntegerListParameter } from './parameters/CommandLineIntegerListParameter';
14
+ export { CommandLineChoiceParameter } from './parameters/CommandLineChoiceParameter';
15
+ export { CommandLineChoiceListParameter } from './parameters/CommandLineChoiceListParameter';
16
+ export { CommandLineRemainder } from './parameters/CommandLineRemainder';
17
+ export { CommandLineParameterProvider, ICommandLineParserData as _ICommandLineParserData } from './providers/CommandLineParameterProvider';
18
+ export { ICommandLineParserOptions, CommandLineParser } from './providers/CommandLineParser';
19
+ export { DynamicCommandLineAction } from './providers/DynamicCommandLineAction';
20
+ export { DynamicCommandLineParser } from './providers/DynamicCommandLineParser';
21
+ export { CommandLineConstants } from './Constants';
22
+ export { CommandLineHelper } from './CommandLineHelper';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE7F,OAAO,EACL,0BAA0B,EAC1B,sCAAsC,EACtC,0BAA0B,EAC1B,4BAA4B,EAC5B,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,gCAAgC,EACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,IAAI,uBAAuB,EAClD,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAE7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ /**
6
+ * An object-oriented command-line parser for TypeScript projects.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ var CommandLineAction_1 = require("./providers/CommandLineAction");
11
+ Object.defineProperty(exports, "CommandLineAction", { enumerable: true, get: function () { return CommandLineAction_1.CommandLineAction; } });
12
+ var BaseClasses_1 = require("./parameters/BaseClasses");
13
+ Object.defineProperty(exports, "CommandLineParameterKind", { enumerable: true, get: function () { return BaseClasses_1.CommandLineParameterKind; } });
14
+ Object.defineProperty(exports, "CommandLineParameter", { enumerable: true, get: function () { return BaseClasses_1.CommandLineParameter; } });
15
+ Object.defineProperty(exports, "CommandLineParameterWithArgument", { enumerable: true, get: function () { return BaseClasses_1.CommandLineParameterWithArgument; } });
16
+ var CommandLineFlagParameter_1 = require("./parameters/CommandLineFlagParameter");
17
+ Object.defineProperty(exports, "CommandLineFlagParameter", { enumerable: true, get: function () { return CommandLineFlagParameter_1.CommandLineFlagParameter; } });
18
+ var CommandLineStringParameter_1 = require("./parameters/CommandLineStringParameter");
19
+ Object.defineProperty(exports, "CommandLineStringParameter", { enumerable: true, get: function () { return CommandLineStringParameter_1.CommandLineStringParameter; } });
20
+ var CommandLineStringListParameter_1 = require("./parameters/CommandLineStringListParameter");
21
+ Object.defineProperty(exports, "CommandLineStringListParameter", { enumerable: true, get: function () { return CommandLineStringListParameter_1.CommandLineStringListParameter; } });
22
+ var CommandLineIntegerParameter_1 = require("./parameters/CommandLineIntegerParameter");
23
+ Object.defineProperty(exports, "CommandLineIntegerParameter", { enumerable: true, get: function () { return CommandLineIntegerParameter_1.CommandLineIntegerParameter; } });
24
+ var CommandLineIntegerListParameter_1 = require("./parameters/CommandLineIntegerListParameter");
25
+ Object.defineProperty(exports, "CommandLineIntegerListParameter", { enumerable: true, get: function () { return CommandLineIntegerListParameter_1.CommandLineIntegerListParameter; } });
26
+ var CommandLineChoiceParameter_1 = require("./parameters/CommandLineChoiceParameter");
27
+ Object.defineProperty(exports, "CommandLineChoiceParameter", { enumerable: true, get: function () { return CommandLineChoiceParameter_1.CommandLineChoiceParameter; } });
28
+ var CommandLineChoiceListParameter_1 = require("./parameters/CommandLineChoiceListParameter");
29
+ Object.defineProperty(exports, "CommandLineChoiceListParameter", { enumerable: true, get: function () { return CommandLineChoiceListParameter_1.CommandLineChoiceListParameter; } });
30
+ var CommandLineRemainder_1 = require("./parameters/CommandLineRemainder");
31
+ Object.defineProperty(exports, "CommandLineRemainder", { enumerable: true, get: function () { return CommandLineRemainder_1.CommandLineRemainder; } });
32
+ var CommandLineParameterProvider_1 = require("./providers/CommandLineParameterProvider");
33
+ Object.defineProperty(exports, "CommandLineParameterProvider", { enumerable: true, get: function () { return CommandLineParameterProvider_1.CommandLineParameterProvider; } });
34
+ var CommandLineParser_1 = require("./providers/CommandLineParser");
35
+ Object.defineProperty(exports, "CommandLineParser", { enumerable: true, get: function () { return CommandLineParser_1.CommandLineParser; } });
36
+ var DynamicCommandLineAction_1 = require("./providers/DynamicCommandLineAction");
37
+ Object.defineProperty(exports, "DynamicCommandLineAction", { enumerable: true, get: function () { return DynamicCommandLineAction_1.DynamicCommandLineAction; } });
38
+ var DynamicCommandLineParser_1 = require("./providers/DynamicCommandLineParser");
39
+ Object.defineProperty(exports, "DynamicCommandLineParser", { enumerable: true, get: function () { return DynamicCommandLineParser_1.DynamicCommandLineParser; } });
40
+ var CommandLineHelper_1 = require("./CommandLineHelper");
41
+ Object.defineProperty(exports, "CommandLineHelper", { enumerable: true, get: function () { return CommandLineHelper_1.CommandLineHelper; } });
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D;;;;GAIG;AAEH,mEAA6F;AAApF,sHAAA,iBAAiB,OAAA;AAe1B,wDAIkC;AAHhC,uHAAA,wBAAwB,OAAA;AACxB,mHAAA,oBAAoB,OAAA;AACpB,+HAAA,gCAAgC,OAAA;AAGlC,kFAAiF;AAAxE,oIAAA,wBAAwB,OAAA;AACjC,sFAAqF;AAA5E,wIAAA,0BAA0B,OAAA;AACnC,8FAA6F;AAApF,gJAAA,8BAA8B,OAAA;AACvC,wFAAuF;AAA9E,0IAAA,2BAA2B,OAAA;AACpC,gGAA+F;AAAtF,kJAAA,+BAA+B,OAAA;AACxC,sFAAqF;AAA5E,wIAAA,0BAA0B,OAAA;AACnC,8FAA6F;AAApF,gJAAA,8BAA8B,OAAA;AACvC,0EAAyE;AAAhE,4HAAA,oBAAoB,OAAA;AAE7B,yFAGkD;AAFhD,4IAAA,4BAA4B,OAAA;AAI9B,mEAA6F;AAAzD,sHAAA,iBAAiB,OAAA;AAErD,iFAAgF;AAAvE,oIAAA,wBAAwB,OAAA;AAEjC,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.\r\n// See LICENSE in the project root for license information.\r\n\r\n/**\r\n * An object-oriented command-line parser for TypeScript projects.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nexport { CommandLineAction, ICommandLineActionOptions } from './providers/CommandLineAction';\r\n\r\nexport {\r\n IBaseCommandLineDefinition,\r\n IBaseCommandLineDefinitionWithArgument,\r\n ICommandLineFlagDefinition,\r\n ICommandLineStringDefinition,\r\n ICommandLineStringListDefinition,\r\n ICommandLineIntegerDefinition,\r\n ICommandLineIntegerListDefinition,\r\n ICommandLineChoiceDefinition,\r\n ICommandLineChoiceListDefinition,\r\n ICommandLineRemainderDefinition\r\n} from './parameters/CommandLineDefinition';\r\n\r\nexport {\r\n CommandLineParameterKind,\r\n CommandLineParameter,\r\n CommandLineParameterWithArgument\r\n} from './parameters/BaseClasses';\r\n\r\nexport { CommandLineFlagParameter } from './parameters/CommandLineFlagParameter';\r\nexport { CommandLineStringParameter } from './parameters/CommandLineStringParameter';\r\nexport { CommandLineStringListParameter } from './parameters/CommandLineStringListParameter';\r\nexport { CommandLineIntegerParameter } from './parameters/CommandLineIntegerParameter';\r\nexport { CommandLineIntegerListParameter } from './parameters/CommandLineIntegerListParameter';\r\nexport { CommandLineChoiceParameter } from './parameters/CommandLineChoiceParameter';\r\nexport { CommandLineChoiceListParameter } from './parameters/CommandLineChoiceListParameter';\r\nexport { CommandLineRemainder } from './parameters/CommandLineRemainder';\r\n\r\nexport {\r\n CommandLineParameterProvider,\r\n ICommandLineParserData as _ICommandLineParserData\r\n} from './providers/CommandLineParameterProvider';\r\n\r\nexport { ICommandLineParserOptions, CommandLineParser } from './providers/CommandLineParser';\r\n\r\nexport { DynamicCommandLineAction } from './providers/DynamicCommandLineAction';\r\n\r\nexport { DynamicCommandLineParser } from './providers/DynamicCommandLineParser';\r\n\r\nexport { CommandLineConstants } from './Constants';\r\n\r\nexport { CommandLineHelper } from './CommandLineHelper';\r\n"]}
@@ -0,0 +1,100 @@
1
+ import { IBaseCommandLineDefinition, IBaseCommandLineDefinitionWithArgument } from './CommandLineDefinition';
2
+ /**
3
+ * Identifies the kind of a CommandLineParameter.
4
+ * @public
5
+ */
6
+ export declare enum CommandLineParameterKind {
7
+ /** Indicates a CommandLineChoiceParameter */
8
+ Choice = 0,
9
+ /** Indicates a CommandLineFlagParameter */
10
+ Flag = 1,
11
+ /** Indicates a CommandLineIntegerParameter */
12
+ Integer = 2,
13
+ /** Indicates a CommandLineStringParameter */
14
+ String = 3,
15
+ /** Indicates a CommandLineStringListParameter */
16
+ StringList = 4,
17
+ /** Indicates a CommandLineChoiceListParameter */
18
+ ChoiceList = 5,
19
+ /** Indicates a CommandLineIntegerListParameter */
20
+ IntegerList = 6
21
+ }
22
+ /**
23
+ * The base class for the various command-line parameter types.
24
+ * @public
25
+ */
26
+ export declare abstract class CommandLineParameter {
27
+ private static _longNameRegExp;
28
+ private static _shortNameRegExp;
29
+ private static _environmentVariableRegExp;
30
+ /**
31
+ * A unique internal key used to retrieve the value from the parser's dictionary.
32
+ * @internal
33
+ */
34
+ _parserKey: string | undefined;
35
+ /** {@inheritDoc IBaseCommandLineDefinition.parameterLongName} */
36
+ readonly longName: string;
37
+ /** {@inheritDoc IBaseCommandLineDefinition.parameterShortName} */
38
+ readonly shortName: string | undefined;
39
+ /** {@inheritDoc IBaseCommandLineDefinition.description} */
40
+ readonly description: string;
41
+ /** {@inheritDoc IBaseCommandLineDefinition.required} */
42
+ readonly required: boolean;
43
+ /** {@inheritDoc IBaseCommandLineDefinition.environmentVariable} */
44
+ readonly environmentVariable: string | undefined;
45
+ /** {@inheritDoc IBaseCommandLineDefinition.undocumentedSynonyms } */
46
+ readonly undocumentedSynonyms: string[] | undefined;
47
+ /** @internal */
48
+ constructor(definition: IBaseCommandLineDefinition);
49
+ /**
50
+ * Called internally by CommandLineParameterProvider._processParsedData()
51
+ * @internal
52
+ */
53
+ abstract _setValue(data: any): void;
54
+ /**
55
+ * Returns additional text used by the help formatter.
56
+ * @internal
57
+ */
58
+ _getSupplementaryNotes(supplementaryNotes: string[]): void;
59
+ /**
60
+ * Indicates the type of parameter.
61
+ */
62
+ abstract get kind(): CommandLineParameterKind;
63
+ /**
64
+ * Append the parsed values to the provided string array.
65
+ * @remarks
66
+ * Sometimes a command line parameter is not used directly, but instead gets passed through to another
67
+ * tool that will use it. For example if our parameter comes in as "--max-count 3", then we might want to
68
+ * call `child_process.spawn()` and append ["--max-count", "3"] to the args array for that tool.
69
+ * appendToArgList() appends zero or more strings to the provided array, based on the input command-line
70
+ * that we parsed.
71
+ *
72
+ * If the parameter was omitted from our command-line and has no default value, then
73
+ * nothing will be appended. If the short name was used, the long name will be appended instead.
74
+ * @param argList - the parsed strings will be appended to this string array
75
+ */
76
+ abstract appendToArgList(argList: string[]): void;
77
+ /**
78
+ * Internal usage only. Used to report unexpected output from the argparse library.
79
+ */
80
+ protected reportInvalidData(data: any): never;
81
+ protected validateDefaultValue(hasDefaultValue: boolean): void;
82
+ }
83
+ /**
84
+ * The common base class for parameters types that receive an argument.
85
+ *
86
+ * @remarks
87
+ * An argument is an accompanying command-line token, such as "123" in the
88
+ * example "--max-count 123".
89
+ * @public
90
+ */
91
+ export declare abstract class CommandLineParameterWithArgument extends CommandLineParameter {
92
+ private static _invalidArgumentNameRegExp;
93
+ /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.argumentName} */
94
+ readonly argumentName: string;
95
+ /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.completions} */
96
+ readonly completions: (() => Promise<string[]>) | undefined;
97
+ /** @internal */
98
+ constructor(definition: IBaseCommandLineDefinitionWithArgument);
99
+ }
100
+ //# sourceMappingURL=BaseClasses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseClasses.d.ts","sourceRoot":"","sources":["../../src/parameters/BaseClasses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,sCAAsC,EAAE,MAAM,yBAAyB,CAAC;AAE7G;;;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;AAED;;;GAGG;AACH,8BAAsB,oBAAoB;IAExC,OAAO,CAAC,MAAM,CAAC,eAAe,CAA8B;IAG5D,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAyB;IAMxD,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAgC;IAEzE;;;OAGG;IACI,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtC,iEAAiE;IACjE,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,kEAAkE;IAClE,SAAgB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9C,2DAA2D;IAC3D,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC,wDAAwD;IACxD,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAElC,mEAAmE;IACnE,SAAgB,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IAExD,qEAAqE;IACrE,SAAgB,oBAAoB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAE3D,gBAAgB;gBACG,UAAU,EAAE,0BAA0B;IA+DzD;;;OAGG;aACa,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAE1C;;;OAGG;IACI,sBAAsB,CAAC,kBAAkB,EAAE,MAAM,EAAE,GAAG,IAAI;IAWjE;;OAEG;IACH,aAAoB,IAAI,IAAI,wBAAwB,CAAC;IAErD;;;;;;;;;;;;OAYG;aACa,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAExD;;OAEG;IAEH,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,KAAK;IAI7C,SAAS,CAAC,oBAAoB,CAAC,eAAe,EAAE,OAAO,GAAG,IAAI;CAY/D;AAED;;;;;;;GAOG;AACH,8BAAsB,gCAAiC,SAAQ,oBAAoB;IAEjF,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAwB;IAEjE,wEAAwE;IACxE,SAAgB,YAAY,EAAE,MAAM,CAAC;IAErC,uEAAuE;IACvE,SAAgB,WAAW,EAAE,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;IAEnE,gBAAgB;gBACG,UAAU,EAAE,sCAAsC;CAyBtE"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.CommandLineParameterWithArgument = exports.CommandLineParameter = exports.CommandLineParameterKind = void 0;
6
+ /**
7
+ * Identifies the kind of a CommandLineParameter.
8
+ * @public
9
+ */
10
+ var CommandLineParameterKind;
11
+ (function (CommandLineParameterKind) {
12
+ /** Indicates a CommandLineChoiceParameter */
13
+ CommandLineParameterKind[CommandLineParameterKind["Choice"] = 0] = "Choice";
14
+ /** Indicates a CommandLineFlagParameter */
15
+ CommandLineParameterKind[CommandLineParameterKind["Flag"] = 1] = "Flag";
16
+ /** Indicates a CommandLineIntegerParameter */
17
+ CommandLineParameterKind[CommandLineParameterKind["Integer"] = 2] = "Integer";
18
+ /** Indicates a CommandLineStringParameter */
19
+ CommandLineParameterKind[CommandLineParameterKind["String"] = 3] = "String";
20
+ /** Indicates a CommandLineStringListParameter */
21
+ CommandLineParameterKind[CommandLineParameterKind["StringList"] = 4] = "StringList";
22
+ /** Indicates a CommandLineChoiceListParameter */
23
+ CommandLineParameterKind[CommandLineParameterKind["ChoiceList"] = 5] = "ChoiceList";
24
+ /** Indicates a CommandLineIntegerListParameter */
25
+ CommandLineParameterKind[CommandLineParameterKind["IntegerList"] = 6] = "IntegerList";
26
+ })(CommandLineParameterKind = exports.CommandLineParameterKind || (exports.CommandLineParameterKind = {}));
27
+ /**
28
+ * The base class for the various command-line parameter types.
29
+ * @public
30
+ */
31
+ class CommandLineParameter {
32
+ /** @internal */
33
+ constructor(definition) {
34
+ this.longName = definition.parameterLongName;
35
+ this.shortName = definition.parameterShortName;
36
+ this.description = definition.description;
37
+ this.required = !!definition.required;
38
+ this.environmentVariable = definition.environmentVariable;
39
+ this.undocumentedSynonyms = definition.undocumentedSynonyms;
40
+ if (!CommandLineParameter._longNameRegExp.test(this.longName)) {
41
+ throw new Error(`Invalid name: "${this.longName}". The parameter long name must be` +
42
+ ` lower-case and use dash delimiters (e.g. "--do-a-thing")`);
43
+ }
44
+ if (this.shortName) {
45
+ if (!CommandLineParameter._shortNameRegExp.test(this.shortName)) {
46
+ throw new Error(`Invalid name: "${this.shortName}". The parameter short name must be` +
47
+ ` a dash followed by a single upper-case or lower-case letter (e.g. "-a")`);
48
+ }
49
+ }
50
+ if (this.environmentVariable) {
51
+ if (this.required) {
52
+ // TODO: This constraint is imposed only because argparse enforces "required" parameters, but
53
+ // it does not know about ts-command-line environment variable mappings. We should fix this.
54
+ throw new Error(`An "environmentVariable" cannot be specified for "${this.longName}"` +
55
+ ` because it is a required parameter`);
56
+ }
57
+ if (!CommandLineParameter._environmentVariableRegExp.test(this.environmentVariable)) {
58
+ throw new Error(`Invalid environment variable name: "${this.environmentVariable}". The name must` +
59
+ ` consist only of upper-case letters, numbers, and underscores. It may not start with a number.`);
60
+ }
61
+ }
62
+ if (this.undocumentedSynonyms && this.undocumentedSynonyms.length > 0) {
63
+ if (this.required) {
64
+ throw new Error('Undocumented synonyms are not allowed on required parameters.');
65
+ }
66
+ for (const undocumentedSynonym of this.undocumentedSynonyms) {
67
+ if (this.longName === undocumentedSynonym) {
68
+ throw new Error(`Invalid name: "${undocumentedSynonym}". Undocumented Synonyms must not be the same` +
69
+ ` as the the long name.`);
70
+ }
71
+ else if (!CommandLineParameter._longNameRegExp.test(undocumentedSynonym)) {
72
+ throw new Error(`Invalid name: "${undocumentedSynonym}". All undocumented Synonyms name must be` +
73
+ ` lower-case and use dash delimiters (e.g. "--do-a-thing")`);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ /**
79
+ * Returns additional text used by the help formatter.
80
+ * @internal
81
+ */
82
+ _getSupplementaryNotes(supplementaryNotes) {
83
+ // virtual
84
+ if (this.environmentVariable !== undefined) {
85
+ supplementaryNotes.push('This parameter may alternatively be specified via the ' +
86
+ this.environmentVariable +
87
+ ' environment variable.');
88
+ }
89
+ }
90
+ /**
91
+ * Internal usage only. Used to report unexpected output from the argparse library.
92
+ */
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
+ reportInvalidData(data) {
95
+ throw new Error(`Unexpected data object for parameter "${this.longName}": ` + JSON.stringify(data));
96
+ }
97
+ validateDefaultValue(hasDefaultValue) {
98
+ if (this.required && hasDefaultValue) {
99
+ // If a parameter is "required", then the user understands that they always need to
100
+ // specify a value for this parameter (either via the command line or via an environment variable).
101
+ // It would be confusing to allow a default value that sometimes allows the "required" parameter
102
+ // to be omitted. If you sometimes don't have a suitable default value, then the better approach
103
+ // is to throw a custom error explaining why the parameter is required in that case.
104
+ throw new Error(`A default value cannot be specified for "${this.longName}" because it is a "required" parameter`);
105
+ }
106
+ }
107
+ }
108
+ exports.CommandLineParameter = CommandLineParameter;
109
+ // Example: "--do-something"
110
+ CommandLineParameter._longNameRegExp = /^-(-[a-z0-9]+)+$/;
111
+ // Example: "-d"
112
+ CommandLineParameter._shortNameRegExp = /^-[a-zA-Z]$/;
113
+ // "Environment variable names used by the utilities in the Shell and Utilities volume of
114
+ // IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore)
115
+ // from the characters defined in Portable Character Set and do not begin with a digit."
116
+ // Example: "THE_SETTING"
117
+ CommandLineParameter._environmentVariableRegExp = /^[A-Z_][A-Z0-9_]*$/;
118
+ /**
119
+ * The common base class for parameters types that receive an argument.
120
+ *
121
+ * @remarks
122
+ * An argument is an accompanying command-line token, such as "123" in the
123
+ * example "--max-count 123".
124
+ * @public
125
+ */
126
+ class CommandLineParameterWithArgument extends CommandLineParameter {
127
+ /** @internal */
128
+ constructor(definition) {
129
+ super(definition);
130
+ if (definition.argumentName === '') {
131
+ throw new Error('The argument name cannot be an empty string. (For the default name, specify undefined.)');
132
+ }
133
+ if (definition.argumentName.toUpperCase() !== definition.argumentName) {
134
+ throw new Error(`Invalid name: "${definition.argumentName}". The argument name must be all upper case.`);
135
+ }
136
+ const match = definition.argumentName.match(CommandLineParameterWithArgument._invalidArgumentNameRegExp);
137
+ if (match) {
138
+ throw new Error(`The argument name "${definition.argumentName}" contains an invalid character "${match[0]}".` +
139
+ ` Only upper-case letters, numbers, and underscores are allowed.`);
140
+ }
141
+ this.argumentName = definition.argumentName;
142
+ this.completions = definition.completions;
143
+ }
144
+ }
145
+ exports.CommandLineParameterWithArgument = CommandLineParameterWithArgument;
146
+ // Matches the first character that *isn't* part of a valid upper-case argument name such as "URL_2"
147
+ CommandLineParameterWithArgument._invalidArgumentNameRegExp = /[^A-Z_0-9]/;
148
+ //# sourceMappingURL=BaseClasses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseClasses.js","sourceRoot":"","sources":["../../src/parameters/BaseClasses.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { IBaseCommandLineDefinition, IBaseCommandLineDefinitionWithArgument } from './CommandLineDefinition';\r\n\r\n/**\r\n * Identifies the kind of a CommandLineParameter.\r\n * @public\r\n */\r\nexport enum CommandLineParameterKind {\r\n /** Indicates a CommandLineChoiceParameter */\r\n Choice,\r\n /** Indicates a CommandLineFlagParameter */\r\n Flag,\r\n /** Indicates a CommandLineIntegerParameter */\r\n Integer,\r\n /** Indicates a CommandLineStringParameter */\r\n String,\r\n /** Indicates a CommandLineStringListParameter */\r\n StringList,\r\n /** Indicates a CommandLineChoiceListParameter */\r\n ChoiceList,\r\n /** Indicates a CommandLineIntegerListParameter */\r\n IntegerList\r\n}\r\n\r\n/**\r\n * The base class for the various command-line parameter types.\r\n * @public\r\n */\r\nexport abstract class CommandLineParameter {\r\n // Example: \"--do-something\"\r\n private static _longNameRegExp: RegExp = /^-(-[a-z0-9]+)+$/;\r\n\r\n // Example: \"-d\"\r\n private static _shortNameRegExp: RegExp = /^-[a-zA-Z]$/;\r\n\r\n // \"Environment variable names used by the utilities in the Shell and Utilities volume of\r\n // IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore)\r\n // from the characters defined in Portable Character Set and do not begin with a digit.\"\r\n // Example: \"THE_SETTING\"\r\n private static _environmentVariableRegExp: RegExp = /^[A-Z_][A-Z0-9_]*$/;\r\n\r\n /**\r\n * A unique internal key used to retrieve the value from the parser's dictionary.\r\n * @internal\r\n */\r\n public _parserKey: string | undefined;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinition.parameterLongName} */\r\n public readonly longName: string;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinition.parameterShortName} */\r\n public readonly shortName: string | undefined;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinition.description} */\r\n public readonly description: string;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinition.required} */\r\n public readonly required: boolean;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinition.environmentVariable} */\r\n public readonly environmentVariable: string | undefined;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinition.undocumentedSynonyms } */\r\n public readonly undocumentedSynonyms: string[] | undefined;\r\n\r\n /** @internal */\r\n public constructor(definition: IBaseCommandLineDefinition) {\r\n this.longName = definition.parameterLongName;\r\n this.shortName = definition.parameterShortName;\r\n this.description = definition.description;\r\n this.required = !!definition.required;\r\n this.environmentVariable = definition.environmentVariable;\r\n this.undocumentedSynonyms = definition.undocumentedSynonyms;\r\n\r\n if (!CommandLineParameter._longNameRegExp.test(this.longName)) {\r\n throw new Error(\r\n `Invalid name: \"${this.longName}\". The parameter long name must be` +\r\n ` lower-case and use dash delimiters (e.g. \"--do-a-thing\")`\r\n );\r\n }\r\n\r\n if (this.shortName) {\r\n if (!CommandLineParameter._shortNameRegExp.test(this.shortName)) {\r\n throw new Error(\r\n `Invalid name: \"${this.shortName}\". The parameter short name must be` +\r\n ` a dash followed by a single upper-case or lower-case letter (e.g. \"-a\")`\r\n );\r\n }\r\n }\r\n\r\n if (this.environmentVariable) {\r\n if (this.required) {\r\n // TODO: This constraint is imposed only because argparse enforces \"required\" parameters, but\r\n // it does not know about ts-command-line environment variable mappings. We should fix this.\r\n throw new Error(\r\n `An \"environmentVariable\" cannot be specified for \"${this.longName}\"` +\r\n ` because it is a required parameter`\r\n );\r\n }\r\n\r\n if (!CommandLineParameter._environmentVariableRegExp.test(this.environmentVariable)) {\r\n throw new Error(\r\n `Invalid environment variable name: \"${this.environmentVariable}\". The name must` +\r\n ` consist only of upper-case letters, numbers, and underscores. It may not start with a number.`\r\n );\r\n }\r\n }\r\n\r\n if (this.undocumentedSynonyms && this.undocumentedSynonyms.length > 0) {\r\n if (this.required) {\r\n throw new Error('Undocumented synonyms are not allowed on required parameters.');\r\n }\r\n\r\n for (const undocumentedSynonym of this.undocumentedSynonyms) {\r\n if (this.longName === undocumentedSynonym) {\r\n throw new Error(\r\n `Invalid name: \"${undocumentedSynonym}\". Undocumented Synonyms must not be the same` +\r\n ` as the the long name.`\r\n );\r\n } else if (!CommandLineParameter._longNameRegExp.test(undocumentedSynonym)) {\r\n throw new Error(\r\n `Invalid name: \"${undocumentedSynonym}\". All undocumented Synonyms name must be` +\r\n ` lower-case and use dash delimiters (e.g. \"--do-a-thing\")`\r\n );\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called internally by CommandLineParameterProvider._processParsedData()\r\n * @internal\r\n */\r\n public abstract _setValue(data: any): void; // eslint-disable-line @typescript-eslint/no-explicit-any\r\n\r\n /**\r\n * Returns additional text used by the help formatter.\r\n * @internal\r\n */\r\n public _getSupplementaryNotes(supplementaryNotes: string[]): void {\r\n // virtual\r\n if (this.environmentVariable !== undefined) {\r\n supplementaryNotes.push(\r\n 'This parameter may alternatively be specified via the ' +\r\n this.environmentVariable +\r\n ' environment variable.'\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Indicates the type of parameter.\r\n */\r\n public abstract get kind(): CommandLineParameterKind;\r\n\r\n /**\r\n * Append the parsed values to the provided string array.\r\n * @remarks\r\n * Sometimes a command line parameter is not used directly, but instead gets passed through to another\r\n * tool that will use it. For example if our parameter comes in as \"--max-count 3\", then we might want to\r\n * call `child_process.spawn()` and append [\"--max-count\", \"3\"] to the args array for that tool.\r\n * appendToArgList() appends zero or more strings to the provided array, based on the input command-line\r\n * that we parsed.\r\n *\r\n * If the parameter was omitted from our command-line and has no default value, then\r\n * nothing will be appended. If the short name was used, the long name will be appended instead.\r\n * @param argList - the parsed strings will be appended to this string array\r\n */\r\n public abstract appendToArgList(argList: string[]): void;\r\n\r\n /**\r\n * Internal usage only. Used to report unexpected output from the argparse library.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n protected reportInvalidData(data: any): never {\r\n throw new Error(`Unexpected data object for parameter \"${this.longName}\": ` + JSON.stringify(data));\r\n }\r\n\r\n protected validateDefaultValue(hasDefaultValue: boolean): void {\r\n if (this.required && hasDefaultValue) {\r\n // If a parameter is \"required\", then the user understands that they always need to\r\n // specify a value for this parameter (either via the command line or via an environment variable).\r\n // It would be confusing to allow a default value that sometimes allows the \"required\" parameter\r\n // to be omitted. If you sometimes don't have a suitable default value, then the better approach\r\n // is to throw a custom error explaining why the parameter is required in that case.\r\n throw new Error(\r\n `A default value cannot be specified for \"${this.longName}\" because it is a \"required\" parameter`\r\n );\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The common base class for parameters types that receive an argument.\r\n *\r\n * @remarks\r\n * An argument is an accompanying command-line token, such as \"123\" in the\r\n * example \"--max-count 123\".\r\n * @public\r\n */\r\nexport abstract class CommandLineParameterWithArgument extends CommandLineParameter {\r\n // Matches the first character that *isn't* part of a valid upper-case argument name such as \"URL_2\"\r\n private static _invalidArgumentNameRegExp: RegExp = /[^A-Z_0-9]/;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.argumentName} */\r\n public readonly argumentName: string;\r\n\r\n /** {@inheritDoc IBaseCommandLineDefinitionWithArgument.completions} */\r\n public readonly completions: (() => Promise<string[]>) | undefined;\r\n\r\n /** @internal */\r\n public constructor(definition: IBaseCommandLineDefinitionWithArgument) {\r\n super(definition);\r\n\r\n if (definition.argumentName === '') {\r\n throw new Error(\r\n 'The argument name cannot be an empty string. (For the default name, specify undefined.)'\r\n );\r\n }\r\n if (definition.argumentName.toUpperCase() !== definition.argumentName) {\r\n throw new Error(\r\n `Invalid name: \"${definition.argumentName}\". The argument name must be all upper case.`\r\n );\r\n }\r\n const match: RegExpMatchArray | null = definition.argumentName.match(\r\n CommandLineParameterWithArgument._invalidArgumentNameRegExp\r\n );\r\n if (match) {\r\n throw new Error(\r\n `The argument name \"${definition.argumentName}\" contains an invalid character \"${match[0]}\".` +\r\n ` Only upper-case letters, numbers, and underscores are allowed.`\r\n );\r\n }\r\n this.argumentName = definition.argumentName;\r\n this.completions = definition.completions;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,33 @@
1
+ import { ICommandLineChoiceListDefinition } from './CommandLineDefinition';
2
+ import { CommandLineParameter, CommandLineParameterKind } from './BaseClasses';
3
+ /**
4
+ * The data type returned by {@link CommandLineParameterProvider.defineChoiceListParameter}.
5
+ * @public
6
+ */
7
+ export declare class CommandLineChoiceListParameter extends CommandLineParameter {
8
+ /** {@inheritDoc ICommandLineChoiceListDefinition.alternatives} */
9
+ readonly alternatives: ReadonlyArray<string>;
10
+ private _values;
11
+ /** {@inheritDoc ICommandLineChoiceListDefinition.completions} */
12
+ readonly completions: (() => Promise<string[]>) | undefined;
13
+ /** @internal */
14
+ constructor(definition: ICommandLineChoiceListDefinition);
15
+ /** {@inheritDoc CommandLineParameter.kind} */
16
+ get kind(): CommandLineParameterKind;
17
+ /**
18
+ * {@inheritDoc CommandLineParameter._setValue}
19
+ * @internal
20
+ */
21
+ _setValue(data: any): void;
22
+ /**
23
+ * Returns the string arguments for a choice list parameter that was parsed from the command line.
24
+ *
25
+ * @remarks
26
+ * The array will be empty if the command-line has not been parsed yet,
27
+ * or if the parameter was omitted and has no default value.
28
+ */
29
+ get values(): ReadonlyArray<string>;
30
+ /** {@inheritDoc CommandLineParameter.appendToArgList} @override */
31
+ appendToArgList(argList: string[]): void;
32
+ }
33
+ //# sourceMappingURL=CommandLineChoiceListParameter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLineChoiceListParameter.d.ts","sourceRoot":"","sources":["../../src/parameters/CommandLineChoiceListParameter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG/E;;;GAGG;AACH,qBAAa,8BAA+B,SAAQ,oBAAoB;IACtE,kEAAkE;IAClE,SAAgB,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEpD,OAAO,CAAC,OAAO,CAAgB;IAE/B,iEAAiE;IACjE,SAAgB,WAAW,EAAE,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;IAEnE,gBAAgB;gBACG,UAAU,EAAE,gCAAgC;IAa/D,8CAA8C;IAC9C,IAAW,IAAI,IAAI,wBAAwB,CAE1C;IAED;;;OAGG;IAEI,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAqCjC;;;;;;OAMG;IACH,IAAW,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,CAEzC;IAED,mEAAmE;IAC5D,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;CAQhD"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.CommandLineChoiceListParameter = void 0;
6
+ const BaseClasses_1 = require("./BaseClasses");
7
+ const EnvironmentVariableParser_1 = require("./EnvironmentVariableParser");
8
+ /**
9
+ * The data type returned by {@link CommandLineParameterProvider.defineChoiceListParameter}.
10
+ * @public
11
+ */
12
+ class CommandLineChoiceListParameter extends BaseClasses_1.CommandLineParameter {
13
+ /** @internal */
14
+ constructor(definition) {
15
+ super(definition);
16
+ this._values = [];
17
+ if (definition.alternatives.length < 1) {
18
+ throw new Error(`When defining a choice list parameter, the alternatives list must contain at least one value.`);
19
+ }
20
+ this.alternatives = definition.alternatives;
21
+ this.completions = definition.completions;
22
+ }
23
+ /** {@inheritDoc CommandLineParameter.kind} */
24
+ get kind() {
25
+ return BaseClasses_1.CommandLineParameterKind.ChoiceList;
26
+ }
27
+ /**
28
+ * {@inheritDoc CommandLineParameter._setValue}
29
+ * @internal
30
+ */
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ _setValue(data) {
33
+ // If argparse passed us a value, confirm it is valid
34
+ if (data !== null && data !== undefined) {
35
+ if (!Array.isArray(data)) {
36
+ this.reportInvalidData(data);
37
+ }
38
+ for (const arrayItem of data) {
39
+ if (typeof arrayItem !== 'string') {
40
+ this.reportInvalidData(data);
41
+ }
42
+ }
43
+ this._values = data;
44
+ return;
45
+ }
46
+ if (this.environmentVariable !== undefined) {
47
+ const values = EnvironmentVariableParser_1.EnvironmentVariableParser.parseAsList(this.environmentVariable);
48
+ if (values) {
49
+ for (const value of values) {
50
+ if (this.alternatives.indexOf(value) < 0) {
51
+ const choices = '"' + this.alternatives.join('", "') + '"';
52
+ throw new Error(`Invalid value "${value}" for the environment variable` +
53
+ ` ${this.environmentVariable}. Valid choices are: ${choices}`);
54
+ }
55
+ }
56
+ this._values = values;
57
+ return;
58
+ }
59
+ }
60
+ // (No default value for choice lists)
61
+ this._values = [];
62
+ }
63
+ /**
64
+ * Returns the string arguments for a choice list parameter that was parsed from the command line.
65
+ *
66
+ * @remarks
67
+ * The array will be empty if the command-line has not been parsed yet,
68
+ * or if the parameter was omitted and has no default value.
69
+ */
70
+ get values() {
71
+ return this._values;
72
+ }
73
+ /** {@inheritDoc CommandLineParameter.appendToArgList} @override */
74
+ appendToArgList(argList) {
75
+ if (this.values.length > 0) {
76
+ for (const value of this.values) {
77
+ argList.push(this.longName);
78
+ argList.push(value);
79
+ }
80
+ }
81
+ }
82
+ }
83
+ exports.CommandLineChoiceListParameter = CommandLineChoiceListParameter;
84
+ //# sourceMappingURL=CommandLineChoiceListParameter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLineChoiceListParameter.js","sourceRoot":"","sources":["../../src/parameters/CommandLineChoiceListParameter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,+CAA+E;AAC/E,2EAAwE;AAExE;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,kCAAoB;IAStE,gBAAgB;IAChB,YAAmB,UAA4C;QAC7D,KAAK,CAAC,UAAU,CAAC,CAAC;QAPZ,YAAO,GAAa,EAAE,CAAC;QAS7B,IAAI,UAAU,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CACb,+FAA+F,CAChG,CAAC;SACH;QAED,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,8CAA8C;IAC9C,IAAW,IAAI;QACb,OAAO,sCAAwB,CAAC,UAAU,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,8DAA8D;IACvD,SAAS,CAAC,IAAS;QACxB,qDAAqD;QACrD,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;YACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACxB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;aAC9B;YACD,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE;gBAC5B,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;oBACjC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;iBAC9B;aACF;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,OAAO;SACR;QAED,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS,EAAE;YAC1C,MAAM,MAAM,GAAyB,qDAAyB,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACrG,IAAI,MAAM,EAAE;gBACV,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;oBAC1B,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;wBACxC,MAAM,OAAO,GAAW,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;wBACnE,MAAM,IAAI,KAAK,CACb,kBAAkB,KAAK,gCAAgC;4BACrD,IAAI,IAAI,CAAC,mBAAmB,yBAAyB,OAAO,EAAE,CACjE,CAAC;qBACH;iBACF;gBACD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;gBACtB,OAAO;aACR;SACF;QAED,sCAAsC;QAEtC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,mEAAmE;IAC5D,eAAe,CAAC,OAAiB;QACtC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;gBAC/B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC5B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACrB;SACF;IACH,CAAC;CACF;AA1FD,wEA0FC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { ICommandLineChoiceListDefinition } from './CommandLineDefinition';\r\nimport { CommandLineParameter, CommandLineParameterKind } from './BaseClasses';\r\nimport { EnvironmentVariableParser } from './EnvironmentVariableParser';\r\n\r\n/**\r\n * The data type returned by {@link CommandLineParameterProvider.defineChoiceListParameter}.\r\n * @public\r\n */\r\nexport class CommandLineChoiceListParameter extends CommandLineParameter {\r\n /** {@inheritDoc ICommandLineChoiceListDefinition.alternatives} */\r\n public readonly alternatives: ReadonlyArray<string>;\r\n\r\n private _values: string[] = [];\r\n\r\n /** {@inheritDoc ICommandLineChoiceListDefinition.completions} */\r\n public readonly completions: (() => Promise<string[]>) | undefined;\r\n\r\n /** @internal */\r\n public constructor(definition: ICommandLineChoiceListDefinition) {\r\n super(definition);\r\n\r\n if (definition.alternatives.length < 1) {\r\n throw new Error(\r\n `When defining a choice list parameter, the alternatives list must contain at least one value.`\r\n );\r\n }\r\n\r\n this.alternatives = definition.alternatives;\r\n this.completions = definition.completions;\r\n }\r\n\r\n /** {@inheritDoc CommandLineParameter.kind} */\r\n public get kind(): CommandLineParameterKind {\r\n return CommandLineParameterKind.ChoiceList;\r\n }\r\n\r\n /**\r\n * {@inheritDoc CommandLineParameter._setValue}\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n public _setValue(data: any): void {\r\n // If argparse passed us a value, confirm it is valid\r\n if (data !== null && data !== undefined) {\r\n if (!Array.isArray(data)) {\r\n this.reportInvalidData(data);\r\n }\r\n for (const arrayItem of data) {\r\n if (typeof arrayItem !== 'string') {\r\n this.reportInvalidData(data);\r\n }\r\n }\r\n this._values = data;\r\n return;\r\n }\r\n\r\n if (this.environmentVariable !== undefined) {\r\n const values: string[] | undefined = EnvironmentVariableParser.parseAsList(this.environmentVariable);\r\n if (values) {\r\n for (const value of values) {\r\n if (this.alternatives.indexOf(value) < 0) {\r\n const choices: string = '\"' + this.alternatives.join('\", \"') + '\"';\r\n throw new Error(\r\n `Invalid value \"${value}\" for the environment variable` +\r\n ` ${this.environmentVariable}. Valid choices are: ${choices}`\r\n );\r\n }\r\n }\r\n this._values = values;\r\n return;\r\n }\r\n }\r\n\r\n // (No default value for choice lists)\r\n\r\n this._values = [];\r\n }\r\n\r\n /**\r\n * Returns the string arguments for a choice list parameter that was parsed from the command line.\r\n *\r\n * @remarks\r\n * The array will be empty if the command-line has not been parsed yet,\r\n * or if the parameter was omitted and has no default value.\r\n */\r\n public get values(): ReadonlyArray<string> {\r\n return this._values;\r\n }\r\n\r\n /** {@inheritDoc CommandLineParameter.appendToArgList} @override */\r\n public appendToArgList(argList: string[]): void {\r\n if (this.values.length > 0) {\r\n for (const value of this.values) {\r\n argList.push(this.longName);\r\n argList.push(value);\r\n }\r\n }\r\n }\r\n}\r\n"]}