@optique/core 0.3.0-dev.43 → 0.3.0-dev.44

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 CHANGED
@@ -275,7 +275,14 @@ function run(parser, programName, args, options = {}) {
275
275
  let commandContext = [];
276
276
  if (Array.isArray(parsedValue.commands)) commandContext = parsedValue.commands;
277
277
  else if (typeof parsedValue.commands === "object" && parsedValue.commands != null && "length" in parsedValue.commands) commandContext = parsedValue.commands;
278
- const doc = require_parser.getDocPage(commandContext.length < 1 ? augmentedParser : parser, commandContext);
278
+ let helpGeneratorParser;
279
+ const helpAsCommand = help === "command" || help === "both";
280
+ const versionAsCommand = version === "command" || version === "both";
281
+ if (helpAsCommand && versionAsCommand) helpGeneratorParser = require_parser.longestMatch(parser, helpCommand, versionCommand);
282
+ else if (helpAsCommand) helpGeneratorParser = require_parser.longestMatch(parser, helpCommand);
283
+ else if (versionAsCommand) helpGeneratorParser = require_parser.longestMatch(parser, versionCommand);
284
+ else helpGeneratorParser = parser;
285
+ const doc = require_parser.getDocPage(commandContext.length < 1 ? helpGeneratorParser : parser, commandContext);
279
286
  if (doc != null) stdout(require_doc.formatDocPage(programName, doc, {
280
287
  colors,
281
288
  maxWidth
package/dist/facade.js CHANGED
@@ -275,7 +275,14 @@ function run(parser, programName, args, options = {}) {
275
275
  let commandContext = [];
276
276
  if (Array.isArray(parsedValue.commands)) commandContext = parsedValue.commands;
277
277
  else if (typeof parsedValue.commands === "object" && parsedValue.commands != null && "length" in parsedValue.commands) commandContext = parsedValue.commands;
278
- const doc = getDocPage(commandContext.length < 1 ? augmentedParser : parser, commandContext);
278
+ let helpGeneratorParser;
279
+ const helpAsCommand = help === "command" || help === "both";
280
+ const versionAsCommand = version === "command" || version === "both";
281
+ if (helpAsCommand && versionAsCommand) helpGeneratorParser = longestMatch(parser, helpCommand, versionCommand);
282
+ else if (helpAsCommand) helpGeneratorParser = longestMatch(parser, helpCommand);
283
+ else if (versionAsCommand) helpGeneratorParser = longestMatch(parser, versionCommand);
284
+ else helpGeneratorParser = parser;
285
+ const doc = getDocPage(commandContext.length < 1 ? helpGeneratorParser : parser, commandContext);
279
286
  if (doc != null) stdout(formatDocPage(programName, doc, {
280
287
  colors,
281
288
  maxWidth
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.3.0-dev.43+2da69082",
3
+ "version": "0.3.0-dev.44+d098ce5a",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",