@optique/core 1.2.0-dev.2274 → 1.2.0-dev.2281
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.
- package/dist/facade.cjs +14 -6
- package/dist/facade.js +14 -6
- package/package.json +2 -2
package/dist/facade.cjs
CHANGED
|
@@ -1054,6 +1054,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1054
1054
|
], programName, parser, classified.source === "command" ? completionParsers.completionCommand : completionParsers.completionOption, stdout, stderr, onCompletionResult, onErrorResult, availableShells, colors, maxWidth, completionCommandNames[0], completionOptionNames[0], classified.source === "option", sectionOrder, rootOptionSuggestions);
|
|
1055
1055
|
case "help": {
|
|
1056
1056
|
let helpGeneratorParser;
|
|
1057
|
+
let docGeneratorParser;
|
|
1057
1058
|
const helpAsCommand = helpCommandConfig != null;
|
|
1058
1059
|
const versionAsCommand = versionCommandConfig != null;
|
|
1059
1060
|
const completionAsCommand = completionCommandConfig != null;
|
|
@@ -1061,10 +1062,16 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1061
1062
|
const versionAsOption = versionOptionConfig != null;
|
|
1062
1063
|
const completionAsOption = completionOptionConfig != null;
|
|
1063
1064
|
const requestedCommand = classified.commands[0];
|
|
1064
|
-
if (requestedCommand != null && !classified.preferUserCommandDocs && completionCommandNames.includes(requestedCommand) && completionAsCommand && completionParsers.completionCommand)
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
else {
|
|
1065
|
+
if (requestedCommand != null && !classified.preferUserCommandDocs && completionCommandNames.includes(requestedCommand) && completionAsCommand && completionParsers.completionCommand) {
|
|
1066
|
+
helpGeneratorParser = completionParsers.completionCommand;
|
|
1067
|
+
docGeneratorParser = helpGeneratorParser;
|
|
1068
|
+
} else if (requestedCommand != null && !classified.preferUserCommandDocs && helpCommandNames.includes(requestedCommand) && helpAsCommand && helpParsers.helpCommand) {
|
|
1069
|
+
helpGeneratorParser = helpParsers.helpCommand;
|
|
1070
|
+
docGeneratorParser = helpGeneratorParser;
|
|
1071
|
+
} else if (requestedCommand != null && !classified.preferUserCommandDocs && versionCommandNames.includes(requestedCommand) && versionAsCommand && versionParsers.versionCommand) {
|
|
1072
|
+
helpGeneratorParser = versionParsers.versionCommand;
|
|
1073
|
+
docGeneratorParser = helpGeneratorParser;
|
|
1074
|
+
} else {
|
|
1068
1075
|
const commandParsers = [parser];
|
|
1069
1076
|
const groupedMeta = {};
|
|
1070
1077
|
const ungroupedMeta = [];
|
|
@@ -1092,6 +1099,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1092
1099
|
else commandParsers.push(require_constructs.group(label, require_constructs.longestMatch(...optParsers)));
|
|
1093
1100
|
if (commandParsers.length === 1) helpGeneratorParser = commandParsers[0];
|
|
1094
1101
|
else helpGeneratorParser = longestMatchForMetaCommands(...commandParsers);
|
|
1102
|
+
docGeneratorParser = classified.commands.length > 0 ? parser : helpGeneratorParser;
|
|
1095
1103
|
}
|
|
1096
1104
|
const reportInvalidHelpCommand = (validationError) => {
|
|
1097
1105
|
stderr(`Usage: ${indentLines(require_usage.formatUsage(programName, augmentedParser.usage, {
|
|
@@ -1162,7 +1170,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1162
1170
|
res = processStep(resolved);
|
|
1163
1171
|
}
|
|
1164
1172
|
if (res != null) return reportInvalidHelpCommand(res);
|
|
1165
|
-
const docOrPromise$1 = require_internal_parser.getDocPage(
|
|
1173
|
+
const docOrPromise$1 = require_internal_parser.getDocPage(docGeneratorParser, classified.commands);
|
|
1166
1174
|
return docOrPromise$1 instanceof Promise ? docOrPromise$1.then(displayHelp) : displayHelp(docOrPromise$1);
|
|
1167
1175
|
};
|
|
1168
1176
|
return stepResult.then(asyncValidate);
|
|
@@ -1171,7 +1179,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1171
1179
|
}
|
|
1172
1180
|
if (validationResult != null) return reportInvalidHelpCommand(validationResult);
|
|
1173
1181
|
}
|
|
1174
|
-
const docOrPromise = require_internal_parser.getDocPage(
|
|
1182
|
+
const docOrPromise = require_internal_parser.getDocPage(docGeneratorParser, classified.commands);
|
|
1175
1183
|
if (docOrPromise instanceof Promise) return docOrPromise.then(displayHelp);
|
|
1176
1184
|
return displayHelp(docOrPromise);
|
|
1177
1185
|
}
|
package/dist/facade.js
CHANGED
|
@@ -1054,6 +1054,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1054
1054
|
], programName, parser, classified.source === "command" ? completionParsers.completionCommand : completionParsers.completionOption, stdout, stderr, onCompletionResult, onErrorResult, availableShells, colors, maxWidth, completionCommandNames[0], completionOptionNames[0], classified.source === "option", sectionOrder, rootOptionSuggestions);
|
|
1055
1055
|
case "help": {
|
|
1056
1056
|
let helpGeneratorParser;
|
|
1057
|
+
let docGeneratorParser;
|
|
1057
1058
|
const helpAsCommand = helpCommandConfig != null;
|
|
1058
1059
|
const versionAsCommand = versionCommandConfig != null;
|
|
1059
1060
|
const completionAsCommand = completionCommandConfig != null;
|
|
@@ -1061,10 +1062,16 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1061
1062
|
const versionAsOption = versionOptionConfig != null;
|
|
1062
1063
|
const completionAsOption = completionOptionConfig != null;
|
|
1063
1064
|
const requestedCommand = classified.commands[0];
|
|
1064
|
-
if (requestedCommand != null && !classified.preferUserCommandDocs && completionCommandNames.includes(requestedCommand) && completionAsCommand && completionParsers.completionCommand)
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
else {
|
|
1065
|
+
if (requestedCommand != null && !classified.preferUserCommandDocs && completionCommandNames.includes(requestedCommand) && completionAsCommand && completionParsers.completionCommand) {
|
|
1066
|
+
helpGeneratorParser = completionParsers.completionCommand;
|
|
1067
|
+
docGeneratorParser = helpGeneratorParser;
|
|
1068
|
+
} else if (requestedCommand != null && !classified.preferUserCommandDocs && helpCommandNames.includes(requestedCommand) && helpAsCommand && helpParsers.helpCommand) {
|
|
1069
|
+
helpGeneratorParser = helpParsers.helpCommand;
|
|
1070
|
+
docGeneratorParser = helpGeneratorParser;
|
|
1071
|
+
} else if (requestedCommand != null && !classified.preferUserCommandDocs && versionCommandNames.includes(requestedCommand) && versionAsCommand && versionParsers.versionCommand) {
|
|
1072
|
+
helpGeneratorParser = versionParsers.versionCommand;
|
|
1073
|
+
docGeneratorParser = helpGeneratorParser;
|
|
1074
|
+
} else {
|
|
1068
1075
|
const commandParsers = [parser];
|
|
1069
1076
|
const groupedMeta = {};
|
|
1070
1077
|
const ungroupedMeta = [];
|
|
@@ -1092,6 +1099,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1092
1099
|
else commandParsers.push(group(label, longestMatch(...optParsers)));
|
|
1093
1100
|
if (commandParsers.length === 1) helpGeneratorParser = commandParsers[0];
|
|
1094
1101
|
else helpGeneratorParser = longestMatchForMetaCommands(...commandParsers);
|
|
1102
|
+
docGeneratorParser = classified.commands.length > 0 ? parser : helpGeneratorParser;
|
|
1095
1103
|
}
|
|
1096
1104
|
const reportInvalidHelpCommand = (validationError) => {
|
|
1097
1105
|
stderr(`Usage: ${indentLines(formatUsage(programName, augmentedParser.usage, {
|
|
@@ -1162,7 +1170,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1162
1170
|
res = processStep(resolved);
|
|
1163
1171
|
}
|
|
1164
1172
|
if (res != null) return reportInvalidHelpCommand(res);
|
|
1165
|
-
const docOrPromise$1 = getDocPage(
|
|
1173
|
+
const docOrPromise$1 = getDocPage(docGeneratorParser, classified.commands);
|
|
1166
1174
|
return docOrPromise$1 instanceof Promise ? docOrPromise$1.then(displayHelp) : displayHelp(docOrPromise$1);
|
|
1167
1175
|
};
|
|
1168
1176
|
return stepResult.then(asyncValidate);
|
|
@@ -1171,7 +1179,7 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
1171
1179
|
}
|
|
1172
1180
|
if (validationResult != null) return reportInvalidHelpCommand(validationResult);
|
|
1173
1181
|
}
|
|
1174
|
-
const docOrPromise = getDocPage(
|
|
1182
|
+
const docOrPromise = getDocPage(docGeneratorParser, classified.commands);
|
|
1175
1183
|
if (docOrPromise instanceof Promise) return docOrPromise.then(displayHelp);
|
|
1176
1184
|
return displayHelp(docOrPromise);
|
|
1177
1185
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.2.0-dev.
|
|
3
|
+
"version": "1.2.0-dev.2281",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
"fast-check": "^4.7.0",
|
|
226
226
|
"tsdown": "^0.13.0",
|
|
227
227
|
"typescript": "^5.8.3",
|
|
228
|
-
"@optique/env": "1.2.0-dev.
|
|
228
|
+
"@optique/env": "1.2.0-dev.2281+9d37b9cc"
|
|
229
229
|
},
|
|
230
230
|
"scripts": {
|
|
231
231
|
"build": "tsdown",
|