@optique/core 0.10.5-dev.417 → 0.10.5
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 +6 -0
- package/dist/facade.js +6 -0
- package/package.json +1 -1
package/dist/facade.cjs
CHANGED
|
@@ -542,6 +542,9 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
542
542
|
const helpAsCommand = help === "command" || help === "both";
|
|
543
543
|
const versionAsCommand = version === "command" || version === "both";
|
|
544
544
|
const completionAsCommand = completion === "command" || completion === "both";
|
|
545
|
+
const helpAsOption = help === "option" || help === "both";
|
|
546
|
+
const versionAsOption = version === "option" || version === "both";
|
|
547
|
+
const completionAsOption = completion === "option" || completion === "both";
|
|
545
548
|
const requestedCommand = classified.commands[0];
|
|
546
549
|
if ((requestedCommand === "completion" || requestedCommand === "completions") && completionAsCommand && completionParsers.completionCommand) helpGeneratorParser = completionParsers.completionCommand;
|
|
547
550
|
else if (requestedCommand === "help" && helpAsCommand && helpParsers.helpCommand) helpGeneratorParser = helpParsers.helpCommand;
|
|
@@ -560,6 +563,9 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
560
563
|
commandParsers.push(...ungroupedMeta);
|
|
561
564
|
for (const [label, parsers] of Object.entries(groupedMeta)) if (parsers.length === 1) commandParsers.push(require_constructs.group(label, parsers[0]));
|
|
562
565
|
else commandParsers.push(require_constructs.group(label, require_constructs.longestMatch(...parsers)));
|
|
566
|
+
if (helpAsOption && helpParsers.helpOption) commandParsers.push(helpParsers.helpOption);
|
|
567
|
+
if (versionAsOption && versionParsers.versionOption) commandParsers.push(versionParsers.versionOption);
|
|
568
|
+
if (completionAsOption && completionParsers.completionOption) commandParsers.push(completionParsers.completionOption);
|
|
563
569
|
if (commandParsers.length === 1) helpGeneratorParser = commandParsers[0];
|
|
564
570
|
else if (commandParsers.length === 2) helpGeneratorParser = require_constructs.longestMatch(commandParsers[0], commandParsers[1]);
|
|
565
571
|
else helpGeneratorParser = require_constructs.longestMatch(...commandParsers);
|
package/dist/facade.js
CHANGED
|
@@ -542,6 +542,9 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
542
542
|
const helpAsCommand = help === "command" || help === "both";
|
|
543
543
|
const versionAsCommand = version === "command" || version === "both";
|
|
544
544
|
const completionAsCommand = completion === "command" || completion === "both";
|
|
545
|
+
const helpAsOption = help === "option" || help === "both";
|
|
546
|
+
const versionAsOption = version === "option" || version === "both";
|
|
547
|
+
const completionAsOption = completion === "option" || completion === "both";
|
|
545
548
|
const requestedCommand = classified.commands[0];
|
|
546
549
|
if ((requestedCommand === "completion" || requestedCommand === "completions") && completionAsCommand && completionParsers.completionCommand) helpGeneratorParser = completionParsers.completionCommand;
|
|
547
550
|
else if (requestedCommand === "help" && helpAsCommand && helpParsers.helpCommand) helpGeneratorParser = helpParsers.helpCommand;
|
|
@@ -560,6 +563,9 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
|
|
|
560
563
|
commandParsers.push(...ungroupedMeta);
|
|
561
564
|
for (const [label, parsers] of Object.entries(groupedMeta)) if (parsers.length === 1) commandParsers.push(group(label, parsers[0]));
|
|
562
565
|
else commandParsers.push(group(label, longestMatch(...parsers)));
|
|
566
|
+
if (helpAsOption && helpParsers.helpOption) commandParsers.push(helpParsers.helpOption);
|
|
567
|
+
if (versionAsOption && versionParsers.versionOption) commandParsers.push(versionParsers.versionOption);
|
|
568
|
+
if (completionAsOption && completionParsers.completionOption) commandParsers.push(completionParsers.completionOption);
|
|
563
569
|
if (commandParsers.length === 1) helpGeneratorParser = commandParsers[0];
|
|
564
570
|
else if (commandParsers.length === 2) helpGeneratorParser = longestMatch(commandParsers[0], commandParsers[1]);
|
|
565
571
|
else helpGeneratorParser = longestMatch(...commandParsers);
|