@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 @@
1
+ {"version":3,"file":"CommandLineAction.d.ts","sourceRoot":"","sources":["../../src/providers/CommandLineAction.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAEtG;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,8BAAsB,iBAAkB,SAAQ,4BAA4B;IAE1E,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA8C;IAE9E,yDAAyD;IACzD,SAAgB,UAAU,EAAE,MAAM,CAAC;IAEnC,sDAAsD;IACtD,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC,4DAA4D;IAC5D,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC,OAAO,CAAC,eAAe,CAAsC;gBAE1C,OAAO,EAAE,yBAAyB;IAiBrD;;;OAGG;IACI,YAAY,CAAC,gBAAgB,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI;IAS/D;;;OAGG;IACI,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI;IAI7D;;;OAGG;IACI,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;OAGG;IACH,SAAS,CAAC,kBAAkB,IAAI,QAAQ,CAAC,cAAc;IAUvD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,IAAI;IAE7C;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAC9C"}
@@ -0,0 +1,73 @@
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.CommandLineAction = void 0;
6
+ const CommandLineParameterProvider_1 = require("./CommandLineParameterProvider");
7
+ /**
8
+ * Represents a sub-command that is part of the CommandLineParser command line.
9
+ * Applications should create subclasses of CommandLineAction corresponding to
10
+ * each action that they want to expose.
11
+ *
12
+ * The action name should be comprised of lower case words separated by hyphens
13
+ * or colons. The name should include an English verb (e.g. "deploy"). Use a
14
+ * hyphen to separate words (e.g. "upload-docs"). A group of related commands
15
+ * can be prefixed with a colon (e.g. "docs:generate", "docs:deploy",
16
+ * "docs:serve", etc).
17
+ *
18
+ * @public
19
+ */
20
+ class CommandLineAction extends CommandLineParameterProvider_1.CommandLineParameterProvider {
21
+ constructor(options) {
22
+ super();
23
+ if (!CommandLineAction._actionNameRegExp.test(options.actionName)) {
24
+ throw new Error(`Invalid action name "${options.actionName}". ` +
25
+ `The name must be comprised of lower-case words optionally separated by hyphens or colons.`);
26
+ }
27
+ this.actionName = options.actionName;
28
+ this.summary = options.summary;
29
+ this.documentation = options.documentation;
30
+ this._argumentParser = undefined;
31
+ }
32
+ /**
33
+ * This is called internally by CommandLineParser.addAction()
34
+ * @internal
35
+ */
36
+ _buildParser(actionsSubParser) {
37
+ this._argumentParser = actionsSubParser.addParser(this.actionName, {
38
+ help: this.summary,
39
+ description: this.documentation
40
+ });
41
+ this.onDefineParameters();
42
+ }
43
+ /**
44
+ * This is called internally by CommandLineParser.execute()
45
+ * @internal
46
+ */
47
+ _processParsedData(data) {
48
+ super._processParsedData(data);
49
+ }
50
+ /**
51
+ * Invoked by CommandLineParser.onExecute().
52
+ * @internal
53
+ */
54
+ _execute() {
55
+ return this.onExecute();
56
+ }
57
+ /**
58
+ * {@inheritDoc CommandLineParameterProvider._getArgumentParser}
59
+ * @internal
60
+ */
61
+ _getArgumentParser() {
62
+ // override
63
+ if (!this._argumentParser) {
64
+ // We will improve this in the future
65
+ throw new Error('The CommandLineAction must be added to a CommandLineParser before it can be used');
66
+ }
67
+ return this._argumentParser;
68
+ }
69
+ }
70
+ exports.CommandLineAction = CommandLineAction;
71
+ // Example: "do-something"
72
+ CommandLineAction._actionNameRegExp = /^[a-z][a-z0-9]*([-:][a-z0-9]+)*$/;
73
+ //# sourceMappingURL=CommandLineAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLineAction.js","sourceRoot":"","sources":["../../src/providers/CommandLineAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,iFAAsG;AA0BtG;;;;;;;;;;;;GAYG;AACH,MAAsB,iBAAkB,SAAQ,2DAA4B;IAe1E,YAAmB,OAAkC;QACnD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YACjE,MAAM,IAAI,KAAK,CACb,wBAAwB,OAAO,CAAC,UAAU,KAAK;gBAC7C,2FAA2F,CAC9F,CAAC;SACH;QAED,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAE3C,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,gBAAoC;QACtD,IAAI,CAAC,eAAe,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE;YACjE,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,WAAW,EAAE,IAAI,CAAC,aAAa;SAChC,CAAC,CAAC;QAEH,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,kBAAkB,CAAC,IAA4B;QACpD,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACO,kBAAkB;QAC1B,WAAW;QACX,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,qCAAqC;YACrC,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;SACrG;QAED,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;;AAzEH,8CAoFC;AAnFC,0BAA0B;AACX,mCAAiB,GAAW,kCAAkC,CAAC","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 * as argparse from 'argparse';\r\nimport { CommandLineParameterProvider, ICommandLineParserData } from './CommandLineParameterProvider';\r\n\r\n/**\r\n * Options for the CommandLineAction constructor.\r\n * @public\r\n */\r\nexport interface ICommandLineActionOptions {\r\n /**\r\n * The name of the action. For example, if the tool is called \"example\",\r\n * then the \"build\" action might be invoked as: \"example build -q --some-other-option\"\r\n */\r\n actionName: string;\r\n\r\n /**\r\n * A quick summary that is shown on the main help page, which is displayed\r\n * by the command \"example --help\"\r\n */\r\n summary: string;\r\n\r\n /**\r\n * A detailed description that is shown on the action help page, which is displayed\r\n * by the command \"example build --help\", e.g. for actionName=\"build\".\r\n */\r\n documentation: string;\r\n}\r\n\r\n/**\r\n * Represents a sub-command that is part of the CommandLineParser command line.\r\n * Applications should create subclasses of CommandLineAction corresponding to\r\n * each action that they want to expose.\r\n *\r\n * The action name should be comprised of lower case words separated by hyphens\r\n * or colons. The name should include an English verb (e.g. \"deploy\"). Use a\r\n * hyphen to separate words (e.g. \"upload-docs\"). A group of related commands\r\n * can be prefixed with a colon (e.g. \"docs:generate\", \"docs:deploy\",\r\n * \"docs:serve\", etc).\r\n *\r\n * @public\r\n */\r\nexport abstract class CommandLineAction extends CommandLineParameterProvider {\r\n // Example: \"do-something\"\r\n private static _actionNameRegExp: RegExp = /^[a-z][a-z0-9]*([-:][a-z0-9]+)*$/;\r\n\r\n /** {@inheritDoc ICommandLineActionOptions.actionName} */\r\n public readonly actionName: string;\r\n\r\n /** {@inheritDoc ICommandLineActionOptions.summary} */\r\n public readonly summary: string;\r\n\r\n /** {@inheritDoc ICommandLineActionOptions.documentation} */\r\n public readonly documentation: string;\r\n\r\n private _argumentParser: argparse.ArgumentParser | undefined;\r\n\r\n public constructor(options: ICommandLineActionOptions) {\r\n super();\r\n\r\n if (!CommandLineAction._actionNameRegExp.test(options.actionName)) {\r\n throw new Error(\r\n `Invalid action name \"${options.actionName}\". ` +\r\n `The name must be comprised of lower-case words optionally separated by hyphens or colons.`\r\n );\r\n }\r\n\r\n this.actionName = options.actionName;\r\n this.summary = options.summary;\r\n this.documentation = options.documentation;\r\n\r\n this._argumentParser = undefined;\r\n }\r\n\r\n /**\r\n * This is called internally by CommandLineParser.addAction()\r\n * @internal\r\n */\r\n public _buildParser(actionsSubParser: argparse.SubParser): void {\r\n this._argumentParser = actionsSubParser.addParser(this.actionName, {\r\n help: this.summary,\r\n description: this.documentation\r\n });\r\n\r\n this.onDefineParameters();\r\n }\r\n\r\n /**\r\n * This is called internally by CommandLineParser.execute()\r\n * @internal\r\n */\r\n public _processParsedData(data: ICommandLineParserData): void {\r\n super._processParsedData(data);\r\n }\r\n\r\n /**\r\n * Invoked by CommandLineParser.onExecute().\r\n * @internal\r\n */\r\n public _execute(): Promise<void> {\r\n return this.onExecute();\r\n }\r\n\r\n /**\r\n * {@inheritDoc CommandLineParameterProvider._getArgumentParser}\r\n * @internal\r\n */\r\n protected _getArgumentParser(): argparse.ArgumentParser {\r\n // override\r\n if (!this._argumentParser) {\r\n // We will improve this in the future\r\n throw new Error('The CommandLineAction must be added to a CommandLineParser before it can be used');\r\n }\r\n\r\n return this._argumentParser;\r\n }\r\n\r\n /**\r\n * {@inheritDoc CommandLineParameterProvider.onDefineParameters}\r\n */\r\n protected abstract onDefineParameters(): void;\r\n\r\n /**\r\n * Your subclass should implement this hook to perform the operation.\r\n */\r\n protected abstract onExecute(): Promise<void>;\r\n}\r\n"]}
@@ -0,0 +1,202 @@
1
+ import * as argparse from 'argparse';
2
+ import { ICommandLineChoiceDefinition, ICommandLineChoiceListDefinition, ICommandLineIntegerDefinition, ICommandLineIntegerListDefinition, ICommandLineFlagDefinition, ICommandLineStringDefinition, ICommandLineStringListDefinition, ICommandLineRemainderDefinition } from '../parameters/CommandLineDefinition';
3
+ import { CommandLineParameter } from '../parameters/BaseClasses';
4
+ import { CommandLineChoiceParameter } from '../parameters/CommandLineChoiceParameter';
5
+ import { CommandLineChoiceListParameter } from '../parameters/CommandLineChoiceListParameter';
6
+ import { CommandLineIntegerParameter } from '../parameters/CommandLineIntegerParameter';
7
+ import { CommandLineIntegerListParameter } from '../parameters/CommandLineIntegerListParameter';
8
+ import { CommandLineFlagParameter } from '../parameters/CommandLineFlagParameter';
9
+ import { CommandLineStringParameter } from '../parameters/CommandLineStringParameter';
10
+ import { CommandLineStringListParameter } from '../parameters/CommandLineStringListParameter';
11
+ import { CommandLineRemainder } from '../parameters/CommandLineRemainder';
12
+ /**
13
+ * This is the argparse result data object
14
+ * @internal
15
+ */
16
+ export interface ICommandLineParserData {
17
+ action: string;
18
+ [key: string]: any;
19
+ }
20
+ /**
21
+ * This is the common base class for CommandLineAction and CommandLineParser
22
+ * that provides functionality for defining command-line parameters.
23
+ *
24
+ * @public
25
+ */
26
+ export declare abstract class CommandLineParameterProvider {
27
+ private static _keyCounter;
28
+ private _parameters;
29
+ private _parametersByLongName;
30
+ private _remainder;
31
+ /** @internal */
32
+ constructor();
33
+ /**
34
+ * Returns a collection of the parameters that were defined for this object.
35
+ */
36
+ get parameters(): ReadonlyArray<CommandLineParameter>;
37
+ /**
38
+ * If {@link CommandLineParameterProvider.defineCommandLineRemainder} was called,
39
+ * this object captures any remaining command line arguments after the recognized portion.
40
+ */
41
+ get remainder(): CommandLineRemainder | undefined;
42
+ /**
43
+ * Defines a command-line parameter whose value must be a string from a fixed set of
44
+ * allowable choices (similar to an enum).
45
+ *
46
+ * @remarks
47
+ * Example of a choice parameter:
48
+ * ```
49
+ * example-tool --log-level warn
50
+ * ```
51
+ */
52
+ defineChoiceParameter(definition: ICommandLineChoiceDefinition): CommandLineChoiceParameter;
53
+ /**
54
+ * Returns the CommandLineChoiceParameter with the specified long name.
55
+ * @remarks
56
+ * This method throws an exception if the parameter is not defined.
57
+ */
58
+ getChoiceParameter(parameterLongName: string): CommandLineChoiceParameter;
59
+ /**
60
+ * Defines a command-line parameter whose value must be a string from a fixed set of
61
+ * allowable choices (similar to an enum). The parameter can be specified multiple times to
62
+ * build a list.
63
+ *
64
+ * @remarks
65
+ * Example of a choice list parameter:
66
+ * ```
67
+ * example-tool --allow-color red --allow-color green
68
+ * ```
69
+ */
70
+ defineChoiceListParameter(definition: ICommandLineChoiceListDefinition): CommandLineChoiceListParameter;
71
+ /**
72
+ * Returns the CommandLineChoiceListParameter with the specified long name.
73
+ * @remarks
74
+ * This method throws an exception if the parameter is not defined.
75
+ */
76
+ getChoiceListParameter(parameterLongName: string): CommandLineChoiceListParameter;
77
+ /**
78
+ * Defines a command-line switch whose boolean value is true if the switch is provided,
79
+ * and false otherwise.
80
+ *
81
+ * @remarks
82
+ * Example usage of a flag parameter:
83
+ * ```
84
+ * example-tool --debug
85
+ * ```
86
+ */
87
+ defineFlagParameter(definition: ICommandLineFlagDefinition): CommandLineFlagParameter;
88
+ /**
89
+ * Returns the CommandLineFlagParameter with the specified long name.
90
+ * @remarks
91
+ * This method throws an exception if the parameter is not defined.
92
+ */
93
+ getFlagParameter(parameterLongName: string): CommandLineFlagParameter;
94
+ /**
95
+ * Defines a command-line parameter whose argument is an integer.
96
+ *
97
+ * @remarks
98
+ * Example usage of an integer parameter:
99
+ * ```
100
+ * example-tool --max-attempts 5
101
+ * ```
102
+ */
103
+ defineIntegerParameter(definition: ICommandLineIntegerDefinition): CommandLineIntegerParameter;
104
+ /**
105
+ * Returns the CommandLineIntegerParameter with the specified long name.
106
+ * @remarks
107
+ * This method throws an exception if the parameter is not defined.
108
+ */
109
+ getIntegerParameter(parameterLongName: string): CommandLineIntegerParameter;
110
+ /**
111
+ * Defines a command-line parameter whose argument is an integer. The parameter can be specified
112
+ * multiple times to build a list.
113
+ *
114
+ * @remarks
115
+ * Example usage of an integer list parameter:
116
+ * ```
117
+ * example-tool --avoid 4 --avoid 13
118
+ * ```
119
+ */
120
+ defineIntegerListParameter(definition: ICommandLineIntegerListDefinition): CommandLineIntegerListParameter;
121
+ /**
122
+ * Returns the CommandLineIntegerParameter with the specified long name.
123
+ * @remarks
124
+ * This method throws an exception if the parameter is not defined.
125
+ */
126
+ getIntegerListParameter(parameterLongName: string): CommandLineIntegerListParameter;
127
+ /**
128
+ * Defines a command-line parameter whose argument is a single text string.
129
+ *
130
+ * @remarks
131
+ * Example usage of a string parameter:
132
+ * ```
133
+ * example-tool --message "Hello, world!"
134
+ * ```
135
+ */
136
+ defineStringParameter(definition: ICommandLineStringDefinition): CommandLineStringParameter;
137
+ /**
138
+ * Returns the CommandLineStringParameter with the specified long name.
139
+ * @remarks
140
+ * This method throws an exception if the parameter is not defined.
141
+ */
142
+ getStringParameter(parameterLongName: string): CommandLineStringParameter;
143
+ /**
144
+ * Defines a command-line parameter whose argument is a single text string. The parameter can be
145
+ * specified multiple times to build a list.
146
+ *
147
+ * @remarks
148
+ * Example usage of a string list parameter:
149
+ * ```
150
+ * example-tool --add file1.txt --add file2.txt --add file3.txt
151
+ * ```
152
+ */
153
+ defineStringListParameter(definition: ICommandLineStringListDefinition): CommandLineStringListParameter;
154
+ /**
155
+ * Defines a rule that captures any remaining command line arguments after the recognized portion.
156
+ *
157
+ * @remarks
158
+ * This feature is useful for commands that pass their arguments along to an external tool, relying on
159
+ * that tool to perform validation. (It could also be used to parse parameters without any validation
160
+ * or documentation, but that is not recommended.)
161
+ *
162
+ * Example of capturing the remainder after an optional flag parameter.
163
+ * ```
164
+ * example-tool --my-flag this is the remainder
165
+ * ```
166
+ *
167
+ * In the "--help" documentation, the remainder rule will be represented as "...".
168
+ */
169
+ defineCommandLineRemainder(definition: ICommandLineRemainderDefinition): CommandLineRemainder;
170
+ /**
171
+ * Returns the CommandLineStringListParameter with the specified long name.
172
+ * @remarks
173
+ * This method throws an exception if the parameter is not defined.
174
+ */
175
+ getStringListParameter(parameterLongName: string): CommandLineStringListParameter;
176
+ /**
177
+ * Generates the command-line help text.
178
+ */
179
+ renderHelpText(): string;
180
+ /**
181
+ * Returns a object which maps the long name of each parameter in this.parameters
182
+ * to the stringified form of its value. This is useful for logging telemetry, but
183
+ * it is not the proper way of accessing parameters or their values.
184
+ */
185
+ getParameterStringMap(): Record<string, string>;
186
+ /**
187
+ * The child class should implement this hook to define its command-line parameters,
188
+ * e.g. by calling defineFlagParameter().
189
+ */
190
+ protected abstract onDefineParameters(): void;
191
+ /**
192
+ * Retrieves the argparse object.
193
+ * @internal
194
+ */
195
+ protected abstract _getArgumentParser(): argparse.ArgumentParser;
196
+ /** @internal */
197
+ protected _processParsedData(data: ICommandLineParserData): void;
198
+ private _generateKey;
199
+ private _getParameter;
200
+ private _defineParameter;
201
+ }
202
+ //# sourceMappingURL=CommandLineParameterProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLineParameterProvider.d.ts","sourceRoot":"","sources":["../../src/providers/CommandLineParameterProvider.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,374 @@
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ }) : (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ o[k2] = m[k];
10
+ }));
11
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
12
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
13
+ }) : function(o, v) {
14
+ o["default"] = v;
15
+ });
16
+ var __importStar = (this && this.__importStar) || function (mod) {
17
+ if (mod && mod.__esModule) return mod;
18
+ var result = {};
19
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
20
+ __setModuleDefault(result, mod);
21
+ return result;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.CommandLineParameterProvider = void 0;
25
+ const argparse = __importStar(require("argparse"));
26
+ const BaseClasses_1 = require("../parameters/BaseClasses");
27
+ const CommandLineChoiceParameter_1 = require("../parameters/CommandLineChoiceParameter");
28
+ const CommandLineChoiceListParameter_1 = require("../parameters/CommandLineChoiceListParameter");
29
+ const CommandLineIntegerParameter_1 = require("../parameters/CommandLineIntegerParameter");
30
+ const CommandLineIntegerListParameter_1 = require("../parameters/CommandLineIntegerListParameter");
31
+ const CommandLineFlagParameter_1 = require("../parameters/CommandLineFlagParameter");
32
+ const CommandLineStringParameter_1 = require("../parameters/CommandLineStringParameter");
33
+ const CommandLineStringListParameter_1 = require("../parameters/CommandLineStringListParameter");
34
+ const CommandLineRemainder_1 = require("../parameters/CommandLineRemainder");
35
+ /**
36
+ * This is the common base class for CommandLineAction and CommandLineParser
37
+ * that provides functionality for defining command-line parameters.
38
+ *
39
+ * @public
40
+ */
41
+ class CommandLineParameterProvider {
42
+ /** @internal */
43
+ // Third party code should not inherit subclasses or call this constructor
44
+ constructor() {
45
+ this._parameters = [];
46
+ this._parametersByLongName = new Map();
47
+ }
48
+ /**
49
+ * Returns a collection of the parameters that were defined for this object.
50
+ */
51
+ get parameters() {
52
+ return this._parameters;
53
+ }
54
+ /**
55
+ * If {@link CommandLineParameterProvider.defineCommandLineRemainder} was called,
56
+ * this object captures any remaining command line arguments after the recognized portion.
57
+ */
58
+ get remainder() {
59
+ return this._remainder;
60
+ }
61
+ /**
62
+ * Defines a command-line parameter whose value must be a string from a fixed set of
63
+ * allowable choices (similar to an enum).
64
+ *
65
+ * @remarks
66
+ * Example of a choice parameter:
67
+ * ```
68
+ * example-tool --log-level warn
69
+ * ```
70
+ */
71
+ defineChoiceParameter(definition) {
72
+ const parameter = new CommandLineChoiceParameter_1.CommandLineChoiceParameter(definition);
73
+ this._defineParameter(parameter);
74
+ return parameter;
75
+ }
76
+ /**
77
+ * Returns the CommandLineChoiceParameter with the specified long name.
78
+ * @remarks
79
+ * This method throws an exception if the parameter is not defined.
80
+ */
81
+ getChoiceParameter(parameterLongName) {
82
+ return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.Choice);
83
+ }
84
+ /**
85
+ * Defines a command-line parameter whose value must be a string from a fixed set of
86
+ * allowable choices (similar to an enum). The parameter can be specified multiple times to
87
+ * build a list.
88
+ *
89
+ * @remarks
90
+ * Example of a choice list parameter:
91
+ * ```
92
+ * example-tool --allow-color red --allow-color green
93
+ * ```
94
+ */
95
+ defineChoiceListParameter(definition) {
96
+ const parameter = new CommandLineChoiceListParameter_1.CommandLineChoiceListParameter(definition);
97
+ this._defineParameter(parameter);
98
+ return parameter;
99
+ }
100
+ /**
101
+ * Returns the CommandLineChoiceListParameter with the specified long name.
102
+ * @remarks
103
+ * This method throws an exception if the parameter is not defined.
104
+ */
105
+ getChoiceListParameter(parameterLongName) {
106
+ return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.ChoiceList);
107
+ }
108
+ /**
109
+ * Defines a command-line switch whose boolean value is true if the switch is provided,
110
+ * and false otherwise.
111
+ *
112
+ * @remarks
113
+ * Example usage of a flag parameter:
114
+ * ```
115
+ * example-tool --debug
116
+ * ```
117
+ */
118
+ defineFlagParameter(definition) {
119
+ const parameter = new CommandLineFlagParameter_1.CommandLineFlagParameter(definition);
120
+ this._defineParameter(parameter);
121
+ return parameter;
122
+ }
123
+ /**
124
+ * Returns the CommandLineFlagParameter with the specified long name.
125
+ * @remarks
126
+ * This method throws an exception if the parameter is not defined.
127
+ */
128
+ getFlagParameter(parameterLongName) {
129
+ return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.Flag);
130
+ }
131
+ /**
132
+ * Defines a command-line parameter whose argument is an integer.
133
+ *
134
+ * @remarks
135
+ * Example usage of an integer parameter:
136
+ * ```
137
+ * example-tool --max-attempts 5
138
+ * ```
139
+ */
140
+ defineIntegerParameter(definition) {
141
+ const parameter = new CommandLineIntegerParameter_1.CommandLineIntegerParameter(definition);
142
+ this._defineParameter(parameter);
143
+ return parameter;
144
+ }
145
+ /**
146
+ * Returns the CommandLineIntegerParameter with the specified long name.
147
+ * @remarks
148
+ * This method throws an exception if the parameter is not defined.
149
+ */
150
+ getIntegerParameter(parameterLongName) {
151
+ return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.Integer);
152
+ }
153
+ /**
154
+ * Defines a command-line parameter whose argument is an integer. The parameter can be specified
155
+ * multiple times to build a list.
156
+ *
157
+ * @remarks
158
+ * Example usage of an integer list parameter:
159
+ * ```
160
+ * example-tool --avoid 4 --avoid 13
161
+ * ```
162
+ */
163
+ defineIntegerListParameter(definition) {
164
+ const parameter = new CommandLineIntegerListParameter_1.CommandLineIntegerListParameter(definition);
165
+ this._defineParameter(parameter);
166
+ return parameter;
167
+ }
168
+ /**
169
+ * Returns the CommandLineIntegerParameter with the specified long name.
170
+ * @remarks
171
+ * This method throws an exception if the parameter is not defined.
172
+ */
173
+ getIntegerListParameter(parameterLongName) {
174
+ return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.IntegerList);
175
+ }
176
+ /**
177
+ * Defines a command-line parameter whose argument is a single text string.
178
+ *
179
+ * @remarks
180
+ * Example usage of a string parameter:
181
+ * ```
182
+ * example-tool --message "Hello, world!"
183
+ * ```
184
+ */
185
+ defineStringParameter(definition) {
186
+ const parameter = new CommandLineStringParameter_1.CommandLineStringParameter(definition);
187
+ this._defineParameter(parameter);
188
+ return parameter;
189
+ }
190
+ /**
191
+ * Returns the CommandLineStringParameter with the specified long name.
192
+ * @remarks
193
+ * This method throws an exception if the parameter is not defined.
194
+ */
195
+ getStringParameter(parameterLongName) {
196
+ return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.String);
197
+ }
198
+ /**
199
+ * Defines a command-line parameter whose argument is a single text string. The parameter can be
200
+ * specified multiple times to build a list.
201
+ *
202
+ * @remarks
203
+ * Example usage of a string list parameter:
204
+ * ```
205
+ * example-tool --add file1.txt --add file2.txt --add file3.txt
206
+ * ```
207
+ */
208
+ defineStringListParameter(definition) {
209
+ const parameter = new CommandLineStringListParameter_1.CommandLineStringListParameter(definition);
210
+ this._defineParameter(parameter);
211
+ return parameter;
212
+ }
213
+ /**
214
+ * Defines a rule that captures any remaining command line arguments after the recognized portion.
215
+ *
216
+ * @remarks
217
+ * This feature is useful for commands that pass their arguments along to an external tool, relying on
218
+ * that tool to perform validation. (It could also be used to parse parameters without any validation
219
+ * or documentation, but that is not recommended.)
220
+ *
221
+ * Example of capturing the remainder after an optional flag parameter.
222
+ * ```
223
+ * example-tool --my-flag this is the remainder
224
+ * ```
225
+ *
226
+ * In the "--help" documentation, the remainder rule will be represented as "...".
227
+ */
228
+ defineCommandLineRemainder(definition) {
229
+ if (this._remainder) {
230
+ throw new Error('defineRemainingArguments() has already been called for this provider');
231
+ }
232
+ this._remainder = new CommandLineRemainder_1.CommandLineRemainder(definition);
233
+ const argparseOptions = {
234
+ help: this._remainder.description,
235
+ nargs: argparse.Const.REMAINDER,
236
+ metavar: '"..."'
237
+ };
238
+ this._getArgumentParser().addArgument(argparse.Const.REMAINDER, argparseOptions);
239
+ return this._remainder;
240
+ }
241
+ /**
242
+ * Returns the CommandLineStringListParameter with the specified long name.
243
+ * @remarks
244
+ * This method throws an exception if the parameter is not defined.
245
+ */
246
+ getStringListParameter(parameterLongName) {
247
+ return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.StringList);
248
+ }
249
+ /**
250
+ * Generates the command-line help text.
251
+ */
252
+ renderHelpText() {
253
+ return this._getArgumentParser().formatHelp();
254
+ }
255
+ /**
256
+ * Returns a object which maps the long name of each parameter in this.parameters
257
+ * to the stringified form of its value. This is useful for logging telemetry, but
258
+ * it is not the proper way of accessing parameters or their values.
259
+ */
260
+ getParameterStringMap() {
261
+ const parameterMap = {};
262
+ for (const parameter of this.parameters) {
263
+ switch (parameter.kind) {
264
+ case BaseClasses_1.CommandLineParameterKind.Flag:
265
+ case BaseClasses_1.CommandLineParameterKind.Choice:
266
+ case BaseClasses_1.CommandLineParameterKind.String:
267
+ case BaseClasses_1.CommandLineParameterKind.Integer:
268
+ parameterMap[parameter.longName] = JSON.stringify(parameter.value);
269
+ break;
270
+ case BaseClasses_1.CommandLineParameterKind.StringList:
271
+ case BaseClasses_1.CommandLineParameterKind.IntegerList:
272
+ case BaseClasses_1.CommandLineParameterKind.ChoiceList:
273
+ const arrayValue = parameter.values;
274
+ parameterMap[parameter.longName] = arrayValue ? arrayValue.join(',') : '';
275
+ break;
276
+ }
277
+ }
278
+ return parameterMap;
279
+ }
280
+ /** @internal */
281
+ _processParsedData(data) {
282
+ // Fill in the values for the parameters
283
+ for (const parameter of this._parameters) {
284
+ const value = data[parameter._parserKey]; // eslint-disable-line @typescript-eslint/no-explicit-any
285
+ parameter._setValue(value);
286
+ }
287
+ if (this.remainder) {
288
+ this.remainder._setValue(data[argparse.Const.REMAINDER]);
289
+ }
290
+ }
291
+ _generateKey() {
292
+ return 'key_' + (CommandLineParameterProvider._keyCounter++).toString();
293
+ }
294
+ _getParameter(parameterLongName, expectedKind) {
295
+ const parameter = this._parametersByLongName.get(parameterLongName);
296
+ if (!parameter) {
297
+ throw new Error(`The parameter "${parameterLongName}" is not defined`);
298
+ }
299
+ if (parameter.kind !== expectedKind) {
300
+ throw new Error(`The parameter "${parameterLongName}" is of type "${BaseClasses_1.CommandLineParameterKind[parameter.kind]}"` +
301
+ ` whereas the caller was expecting "${BaseClasses_1.CommandLineParameterKind[expectedKind]}".`);
302
+ }
303
+ return parameter;
304
+ }
305
+ _defineParameter(parameter) {
306
+ if (this._remainder) {
307
+ throw new Error('defineCommandLineRemainder() was already called for this provider;' +
308
+ ' no further parameters can be defined');
309
+ }
310
+ const names = [];
311
+ if (parameter.shortName) {
312
+ names.push(parameter.shortName);
313
+ }
314
+ names.push(parameter.longName);
315
+ parameter._parserKey = this._generateKey();
316
+ let finalDescription = parameter.description;
317
+ const supplementaryNotes = [];
318
+ parameter._getSupplementaryNotes(supplementaryNotes);
319
+ if (supplementaryNotes.length > 0) {
320
+ // If they left the period off the end of their sentence, then add one.
321
+ if (finalDescription.match(/[a-z0-9]"?\s*$/i)) {
322
+ finalDescription = finalDescription.trimRight() + '.';
323
+ }
324
+ // Append the supplementary text
325
+ finalDescription += ' ' + supplementaryNotes.join(' ');
326
+ }
327
+ // NOTE: Our "environmentVariable" feature takes precedence over argparse's "defaultValue",
328
+ // so we have to reimplement that feature.
329
+ const argparseOptions = {
330
+ help: finalDescription,
331
+ dest: parameter._parserKey,
332
+ metavar: parameter.argumentName || undefined,
333
+ required: parameter.required
334
+ };
335
+ switch (parameter.kind) {
336
+ case BaseClasses_1.CommandLineParameterKind.Choice: {
337
+ const choiceParameter = parameter;
338
+ argparseOptions.choices = choiceParameter.alternatives;
339
+ break;
340
+ }
341
+ case BaseClasses_1.CommandLineParameterKind.ChoiceList: {
342
+ const choiceParameter = parameter;
343
+ argparseOptions.choices = choiceParameter.alternatives;
344
+ argparseOptions.action = 'append';
345
+ break;
346
+ }
347
+ case BaseClasses_1.CommandLineParameterKind.Flag:
348
+ argparseOptions.action = 'storeTrue';
349
+ break;
350
+ case BaseClasses_1.CommandLineParameterKind.Integer:
351
+ argparseOptions.type = 'int';
352
+ break;
353
+ case BaseClasses_1.CommandLineParameterKind.IntegerList:
354
+ argparseOptions.type = 'int';
355
+ argparseOptions.action = 'append';
356
+ break;
357
+ case BaseClasses_1.CommandLineParameterKind.String:
358
+ break;
359
+ case BaseClasses_1.CommandLineParameterKind.StringList:
360
+ argparseOptions.action = 'append';
361
+ break;
362
+ }
363
+ const argumentParser = this._getArgumentParser();
364
+ argumentParser.addArgument(names, Object.assign({}, argparseOptions));
365
+ if (parameter.undocumentedSynonyms && parameter.undocumentedSynonyms.length > 0) {
366
+ argumentParser.addArgument(parameter.undocumentedSynonyms, Object.assign(Object.assign({}, argparseOptions), { help: argparse.Const.SUPPRESS }));
367
+ }
368
+ this._parameters.push(parameter);
369
+ this._parametersByLongName.set(parameter.longName, parameter);
370
+ }
371
+ }
372
+ exports.CommandLineParameterProvider = CommandLineParameterProvider;
373
+ CommandLineParameterProvider._keyCounter = 0;
374
+ //# sourceMappingURL=CommandLineParameterProvider.js.map