@yamato-daiwa/es-extensions-nodejs 1.5.0-alpha.6 → 1.5.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.
|
@@ -9,6 +9,7 @@ declare class ConsoleCommandsParser<TargetCommandsAndOptionsCombinations extends
|
|
|
9
9
|
private readonly targetCommandOptions__eachOneWillBeRemovedOnceProcessed;
|
|
10
10
|
private readonly targetCommandOptionsSpecification?;
|
|
11
11
|
static parse<TargetCommandsAndOptionsCombinations extends ConsoleCommandsParser.GeneralizedCommandsAndOptionsCombinations>(argumentsVector: unknown, commandLineInterfaceSpecification: ConsoleCommandsParser.CommandLineInterfaceSpecification): ConsoleCommandsParser.ParsedCommand<TargetCommandsAndOptionsCombinations>;
|
|
12
|
+
static generateFullHelpReference(commandLineInterfaceSpecification: ConsoleCommandsParser.CommandLineInterfaceSpecification): string;
|
|
12
13
|
static setLocalization(newLocalization: ConsoleCommandsParser.Localization): void;
|
|
13
14
|
private constructor();
|
|
14
15
|
private getParsedOptionsAndParameters;
|
|
@@ -16,7 +17,6 @@ declare class ConsoleCommandsParser<TargetCommandsAndOptionsCombinations extends
|
|
|
16
17
|
private processNumberTypeOptionValue;
|
|
17
18
|
private extractAndValidateParsedJSON5_ParameterValue;
|
|
18
19
|
private static isCommandArgumentTheOption;
|
|
19
|
-
private static generateFullHelpReference;
|
|
20
20
|
private static generateSingleCommandHelpReference;
|
|
21
21
|
}
|
|
22
22
|
declare namespace ConsoleCommandsParser {
|
|
@@ -154,6 +154,36 @@ class ConsoleCommandsParser {
|
|
|
154
154
|
...dataHoldingSelfInstance.getParsedOptionsAndParameters()
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
+
static generateFullHelpReference(commandLineInterfaceSpecification) {
|
|
158
|
+
let accumulatingValue = `=== The CLI of ${commandLineInterfaceSpecification.applicationName} application ====================`;
|
|
159
|
+
if ((0, es_extensions_1.isNotUndefined)(commandLineInterfaceSpecification.defaultCommand)) {
|
|
160
|
+
accumulatingValue = "\nHas default command\n";
|
|
161
|
+
for (const [argumentName, argumentSpecification] of Object.entries(commandLineInterfaceSpecification.defaultCommand)) {
|
|
162
|
+
accumulatingValue = `${argumentName}: ${argumentSpecification.type}\n`;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if ((0, es_extensions_1.isNotUndefined)(commandLineInterfaceSpecification.commandPhrases)) {
|
|
166
|
+
accumulatingValue = `${accumulatingValue}\n=== Command phrases`;
|
|
167
|
+
for (const [commandPhrase, argumentsSpecification] of Object.entries(commandLineInterfaceSpecification.commandPhrases)) {
|
|
168
|
+
accumulatingValue = `${accumulatingValue}\n\n` +
|
|
169
|
+
`■ ${commandPhrase}\n`;
|
|
170
|
+
if ((0, es_extensions_1.isUndefined)(argumentsSpecification)) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
accumulatingValue = `${accumulatingValue}\n --- Arguments`;
|
|
174
|
+
for (const [argumentName, argumentSpecification] of Object.entries(argumentsSpecification)) {
|
|
175
|
+
accumulatingValue = `${accumulatingValue}\n` +
|
|
176
|
+
` --${argumentName}:` +
|
|
177
|
+
`${(0, es_extensions_1.insertSubstring)(argumentSpecification.shortcut, {
|
|
178
|
+
modifier: (shortcut) => `\n Shortcut: -${shortcut}`
|
|
179
|
+
})}` +
|
|
180
|
+
`\n Type: ${argumentSpecification.type}` +
|
|
181
|
+
`${"required" in argumentSpecification ? `\n Is required: ${argumentSpecification.required}` : ""}`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return accumulatingValue;
|
|
186
|
+
}
|
|
157
187
|
static setLocalization(newLocalization) {
|
|
158
188
|
ConsoleCommandsParser.localization = newLocalization;
|
|
159
189
|
}
|
|
@@ -452,27 +482,6 @@ class ConsoleCommandsParser {
|
|
|
452
482
|
static isCommandArgumentTheOption(consoleCommandArgument) {
|
|
453
483
|
return consoleCommandArgument.startsWith("-");
|
|
454
484
|
}
|
|
455
|
-
static generateFullHelpReference(commandLineInterfaceSpecification) {
|
|
456
|
-
let accumulatingValue = "";
|
|
457
|
-
if ((0, es_extensions_1.isNotUndefined)(commandLineInterfaceSpecification.defaultCommand)) {
|
|
458
|
-
accumulatingValue = "Has default command\n";
|
|
459
|
-
for (const [argumentName, argumentSpecification] of Object.entries(commandLineInterfaceSpecification.defaultCommand)) {
|
|
460
|
-
accumulatingValue = `${argumentName}: ${argumentSpecification.type}\n`;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
if ((0, es_extensions_1.isNotUndefined)(commandLineInterfaceSpecification.commandPhrases)) {
|
|
464
|
-
for (const [commandPhrase, argumentsSpecification] of Object.entries(commandLineInterfaceSpecification.commandPhrases)) {
|
|
465
|
-
accumulatingValue = `${accumulatingValue}${commandPhrase}:\n`;
|
|
466
|
-
if ((0, es_extensions_1.isUndefined)(argumentsSpecification)) {
|
|
467
|
-
continue;
|
|
468
|
-
}
|
|
469
|
-
for (const [argumentName, argumentSpecification] of Object.entries(argumentsSpecification)) {
|
|
470
|
-
accumulatingValue = `${accumulatingValue}\n ${argumentName}: ${argumentSpecification.type}`;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
return accumulatingValue;
|
|
475
|
-
}
|
|
476
485
|
static generateSingleCommandHelpReference({ commandPhrase, commandOptionsSpecification }) {
|
|
477
486
|
let accumulatingValue = (0, es_extensions_1.isNotUndefined)(commandPhrase) ? commandPhrase : "(Default command)";
|
|
478
487
|
for (const [argumentName, argumentSpecification] of Object.entries(commandOptionsSpecification)) {
|
package/README.md
CHANGED
|
@@ -25,10 +25,10 @@ npm i @yamato-daiwa/es-extensions-nodejs @yamato-daiwa/es-extensions -E
|
|
|
25
25
|
|
|
26
26
|
<dl>
|
|
27
27
|
|
|
28
|
-
<dt><a href="Documentation/ConsoleCommandsParser/ConsoleCommandsParser.md">ConsoleCommandsParser</a></dt>
|
|
29
|
-
<dd>Parsing and validating of CLI commands
|
|
28
|
+
<dt><a href="https://github.com/TokugawaTakeshi/Yamato-Daiwa-ES-Extensions/blob/master/NodeJS/Package/Documentation/ConsoleCommandsParser/ConsoleCommandsParser.md">ConsoleCommandsParser</a></dt>
|
|
29
|
+
<dd>Parsing and validating of CLI commands</dd>
|
|
30
30
|
|
|
31
|
-
<dt><a href="Documentation/Logging/ConsoleApplicationLogger/ConsoleApplicationLogger.md">ConsoleApplicationLogger</a></dt>
|
|
31
|
+
<dt><a href="https://github.com/TokugawaTakeshi/Yamato-Daiwa-ES-Extensions/blob/master/NodeJS/Package/Documentation/Logging/ConsoleApplicationLogger/ConsoleApplicationLogger.md">ConsoleApplicationLogger</a></dt>
|
|
32
32
|
<dd>The implementation of <b>ILogger</b> interface for <a href="https://github.com/TokugawaTakeshi/Yamato-Daiwa-ES-Extensions/blob/master/CoreLibrary/Package/Documentation/Logging/Logger/Logger.md">Logger</a> facade and Node.js environment.</dd>
|
|
33
33
|
|
|
34
34
|
<dt>isErrnoException</dt>
|
|
@@ -43,8 +43,8 @@ npm i @yamato-daiwa/es-extensions-nodejs @yamato-daiwa/es-extensions -E
|
|
|
43
43
|
|
|
44
44
|
<dt>InterProcessInteractionFailedError</dt>
|
|
45
45
|
<dd>
|
|
46
|
-
Intended to be used when the interaction between NodeJS
|
|
47
|
-
Could be actual for the Electron.js where the main process and render process exchanging by data.
|
|
46
|
+
Intended to be used when the interaction between NodeJS processes is not going as expected.
|
|
47
|
+
Could be actual, for example, for the Electron.js where the main process and render process are exchanging by the data.
|
|
48
48
|
</dd>
|
|
49
49
|
|
|
50
50
|
<dt>InvalidConsoleCommandError</dt>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamato-daiwa/es-extensions-nodejs",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Additional to @yamato-daiwa/es-extensions functionality for Node.js environment. Helper functions and classes aimed to reduce the routine code. Build-in TypeScript type safety.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nodejs",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"@types/json5": "0.0.30",
|
|
31
31
|
"@types/mocha": "9.1.1",
|
|
32
32
|
"@types/node": "16.10.2",
|
|
33
|
-
"@yamato-daiwa/style_guides": "0.0.
|
|
33
|
+
"@yamato-daiwa/style_guides": "0.0.16",
|
|
34
34
|
"mocha": "10.0.0",
|
|
35
35
|
"rimraf": "3.0.2",
|
|
36
36
|
"ts-node": "10.8.1",
|
|
37
37
|
"typescript": "4.7.4"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@yamato-daiwa/es-extensions": "1.5.
|
|
40
|
+
"@yamato-daiwa/es-extensions": "1.5.1",
|
|
41
41
|
"json5": "2.2.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|