@optique/core 0.9.9 → 0.9.11

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
@@ -498,6 +498,9 @@ function runParser(parser, programName, args, options = {}) {
498
498
  const helpAsCommand = help === "command" || help === "both";
499
499
  const versionAsCommand = version === "command" || version === "both";
500
500
  const completionAsCommand = completion === "command" || completion === "both";
501
+ const helpAsOption = help === "option" || help === "both";
502
+ const versionAsOption = version === "option" || version === "both";
503
+ const completionAsOption = completion === "option" || completion === "both";
501
504
  const requestedCommand = classified.commands[0];
502
505
  if ((requestedCommand === "completion" || requestedCommand === "completions") && completionAsCommand && completionParsers.completionCommand) helpGeneratorParser = completionParsers.completionCommand;
503
506
  else if (requestedCommand === "help" && helpAsCommand && helpParsers.helpCommand) helpGeneratorParser = helpParsers.helpCommand;
@@ -513,6 +516,9 @@ function runParser(parser, programName, args, options = {}) {
513
516
  if (completionAsCommand) {
514
517
  if (completionParsers.completionCommand) commandParsers.push(completionParsers.completionCommand);
515
518
  }
519
+ if (helpAsOption && helpParsers.helpOption) commandParsers.push(helpParsers.helpOption);
520
+ if (versionAsOption && versionParsers.versionOption) commandParsers.push(versionParsers.versionOption);
521
+ if (completionAsOption && completionParsers.completionOption) commandParsers.push(completionParsers.completionOption);
516
522
  if (commandParsers.length === 1) helpGeneratorParser = commandParsers[0];
517
523
  else if (commandParsers.length === 2) helpGeneratorParser = require_constructs.longestMatch(commandParsers[0], commandParsers[1]);
518
524
  else helpGeneratorParser = require_constructs.longestMatch(...commandParsers);
package/dist/facade.js CHANGED
@@ -498,6 +498,9 @@ function runParser(parser, programName, args, options = {}) {
498
498
  const helpAsCommand = help === "command" || help === "both";
499
499
  const versionAsCommand = version === "command" || version === "both";
500
500
  const completionAsCommand = completion === "command" || completion === "both";
501
+ const helpAsOption = help === "option" || help === "both";
502
+ const versionAsOption = version === "option" || version === "both";
503
+ const completionAsOption = completion === "option" || completion === "both";
501
504
  const requestedCommand = classified.commands[0];
502
505
  if ((requestedCommand === "completion" || requestedCommand === "completions") && completionAsCommand && completionParsers.completionCommand) helpGeneratorParser = completionParsers.completionCommand;
503
506
  else if (requestedCommand === "help" && helpAsCommand && helpParsers.helpCommand) helpGeneratorParser = helpParsers.helpCommand;
@@ -513,6 +516,9 @@ function runParser(parser, programName, args, options = {}) {
513
516
  if (completionAsCommand) {
514
517
  if (completionParsers.completionCommand) commandParsers.push(completionParsers.completionCommand);
515
518
  }
519
+ if (helpAsOption && helpParsers.helpOption) commandParsers.push(helpParsers.helpOption);
520
+ if (versionAsOption && versionParsers.versionOption) commandParsers.push(versionParsers.versionOption);
521
+ if (completionAsOption && completionParsers.completionOption) commandParsers.push(completionParsers.completionOption);
516
522
  if (commandParsers.length === 1) helpGeneratorParser = commandParsers[0];
517
523
  else if (commandParsers.length === 2) helpGeneratorParser = longestMatch(commandParsers[0], commandParsers[1]);
518
524
  else helpGeneratorParser = longestMatch(...commandParsers);
package/dist/parser.cjs CHANGED
@@ -308,11 +308,11 @@ function getDocPageSyncImpl(parser, args) {
308
308
  state: parser.initialState,
309
309
  usage: parser.usage
310
310
  };
311
- do {
311
+ while (context.buffer.length > 0) {
312
312
  const result = parser.parse(context);
313
313
  if (!result.success) break;
314
314
  context = result.next;
315
- } while (context.buffer.length > 0);
315
+ }
316
316
  return buildDocPage(parser, context, args);
317
317
  }
318
318
  /**
@@ -325,11 +325,11 @@ async function getDocPageAsyncImpl(parser, args) {
325
325
  state: parser.initialState,
326
326
  usage: parser.usage
327
327
  };
328
- do {
328
+ while (context.buffer.length > 0) {
329
329
  const result = await parser.parse(context);
330
330
  if (!result.success) break;
331
331
  context = result.next;
332
- } while (context.buffer.length > 0);
332
+ }
333
333
  return buildDocPage(parser, context, args);
334
334
  }
335
335
  /**
package/dist/parser.js CHANGED
@@ -308,11 +308,11 @@ function getDocPageSyncImpl(parser, args) {
308
308
  state: parser.initialState,
309
309
  usage: parser.usage
310
310
  };
311
- do {
311
+ while (context.buffer.length > 0) {
312
312
  const result = parser.parse(context);
313
313
  if (!result.success) break;
314
314
  context = result.next;
315
- } while (context.buffer.length > 0);
315
+ }
316
316
  return buildDocPage(parser, context, args);
317
317
  }
318
318
  /**
@@ -325,11 +325,11 @@ async function getDocPageAsyncImpl(parser, args) {
325
325
  state: parser.initialState,
326
326
  usage: parser.usage
327
327
  };
328
- do {
328
+ while (context.buffer.length > 0) {
329
329
  const result = await parser.parse(context);
330
330
  if (!result.success) break;
331
331
  context = result.next;
332
- } while (context.buffer.length > 0);
332
+ }
333
333
  return buildDocPage(parser, context, args);
334
334
  }
335
335
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.9.9",
3
+ "version": "0.9.11",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",