@optique/core 0.9.0-dev.172 → 0.9.0-dev.176

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/README.md CHANGED
@@ -37,7 +37,7 @@ Quick example
37
37
  -------------
38
38
 
39
39
  ~~~~ typescript
40
- import { run } from "@optique/core/facade";
40
+ import { runParser } from "@optique/core/facade";
41
41
  import { object, option, argument } from "@optique/core/parser";
42
42
  import { string, integer } from "@optique/core/valueparser";
43
43
  import process from "node:process";
@@ -48,7 +48,7 @@ const parser = object({
48
48
  verbose: option("-v", "--verbose"),
49
49
  });
50
50
 
51
- const config = run(parser, "myapp", process.argv.slice(2), {
51
+ const config = runParser(parser, "myapp", process.argv.slice(2), {
52
52
  help: "both",
53
53
  onError: process.exit,
54
54
  });
@@ -4,6 +4,27 @@ const require_suggestion = require('./suggestion.cjs');
4
4
 
5
5
  //#region src/constructs.ts
6
6
  /**
7
+ * Checks if the given token is an option name that requires a value
8
+ * (i.e., has a metavar) within the given usage terms.
9
+ * @param usage The usage terms to search through.
10
+ * @param token The token to check.
11
+ * @returns `true` if the token is an option that requires a value, `false` otherwise.
12
+ */
13
+ function isOptionRequiringValue(usage, token) {
14
+ function traverse(terms) {
15
+ if (!terms || !Array.isArray(terms)) return false;
16
+ for (const term of terms) if (term.type === "option") {
17
+ if (term.metavar && term.names.includes(token)) return true;
18
+ } else if (term.type === "optional" || term.type === "multiple") {
19
+ if (traverse(term.terms)) return true;
20
+ } else if (term.type === "exclusive") {
21
+ for (const exclusiveUsage of term.terms) if (traverse(exclusiveUsage)) return true;
22
+ }
23
+ return false;
24
+ }
25
+ return traverse(usage);
26
+ }
27
+ /**
7
28
  * Extracts required (non-optional) usage terms from a usage array.
8
29
  * @param usage The usage to extract required terms from
9
30
  * @returns Usage containing only required (non-optional) terms
@@ -442,6 +463,16 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
442
463
  },
443
464
  suggest(context, prefix) {
444
465
  const suggestions = [];
466
+ if (context.buffer.length > 0) {
467
+ const lastToken = context.buffer[context.buffer.length - 1];
468
+ for (const [field, parser] of parserPairs) if (isOptionRequiringValue(parser.usage, lastToken)) {
469
+ const fieldState = context.state && typeof context.state === "object" && field in context.state ? context.state[field] : parser.initialState;
470
+ return Array.from(parser.suggest({
471
+ ...context,
472
+ state: fieldState
473
+ }, prefix));
474
+ }
475
+ }
445
476
  for (const [field, parser] of parserPairs) {
446
477
  const fieldState = context.state && typeof context.state === "object" && field in context.state ? context.state[field] : parser.initialState;
447
478
  const fieldSuggestions = parser.suggest({
@@ -4,6 +4,27 @@ import { createErrorWithSuggestions, deduplicateSuggestions } from "./suggestion
4
4
 
5
5
  //#region src/constructs.ts
6
6
  /**
7
+ * Checks if the given token is an option name that requires a value
8
+ * (i.e., has a metavar) within the given usage terms.
9
+ * @param usage The usage terms to search through.
10
+ * @param token The token to check.
11
+ * @returns `true` if the token is an option that requires a value, `false` otherwise.
12
+ */
13
+ function isOptionRequiringValue(usage, token) {
14
+ function traverse(terms) {
15
+ if (!terms || !Array.isArray(terms)) return false;
16
+ for (const term of terms) if (term.type === "option") {
17
+ if (term.metavar && term.names.includes(token)) return true;
18
+ } else if (term.type === "optional" || term.type === "multiple") {
19
+ if (traverse(term.terms)) return true;
20
+ } else if (term.type === "exclusive") {
21
+ for (const exclusiveUsage of term.terms) if (traverse(exclusiveUsage)) return true;
22
+ }
23
+ return false;
24
+ }
25
+ return traverse(usage);
26
+ }
27
+ /**
7
28
  * Extracts required (non-optional) usage terms from a usage array.
8
29
  * @param usage The usage to extract required terms from
9
30
  * @returns Usage containing only required (non-optional) terms
@@ -442,6 +463,16 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
442
463
  },
443
464
  suggest(context, prefix) {
444
465
  const suggestions = [];
466
+ if (context.buffer.length > 0) {
467
+ const lastToken = context.buffer[context.buffer.length - 1];
468
+ for (const [field, parser] of parserPairs) if (isOptionRequiringValue(parser.usage, lastToken)) {
469
+ const fieldState = context.state && typeof context.state === "object" && field in context.state ? context.state[field] : parser.initialState;
470
+ return Array.from(parser.suggest({
471
+ ...context,
472
+ state: fieldState
473
+ }, prefix));
474
+ }
475
+ }
445
476
  for (const [field, parser] of parserPairs) {
446
477
  const fieldState = context.state && typeof context.state === "object" && field in context.state ? context.state[field] : parser.initialState;
447
478
  const fieldSuggestions = parser.suggest({
package/dist/facade.cjs CHANGED
@@ -343,7 +343,7 @@ function classifyResult(result, args) {
343
343
  * Handles shell completion requests.
344
344
  * @since 0.6.0
345
345
  */
346
- function handleCompletion(completionArgs, programName, parser, completionParser, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode) {
346
+ function handleCompletion(completionArgs, programName, parser, completionParser, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName) {
347
347
  const shellName = completionArgs[0] || "";
348
348
  const args = completionArgs.slice(1);
349
349
  if (!shellName) {
@@ -375,7 +375,8 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
375
375
  return onError(1);
376
376
  }
377
377
  if (args.length === 0) {
378
- const completionArg = completionMode === "option" ? "--completion" : "completion";
378
+ const usePlural = completionName === "plural";
379
+ const completionArg = completionMode === "option" ? usePlural ? "--completions" : "--completion" : usePlural ? "completions" : "completion";
379
380
  const script = shell.generateScript(programName, [completionArg, shellName]);
380
381
  stdout(script);
381
382
  } else {
@@ -415,11 +416,12 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
415
416
  * @param options Configuration options for output formatting and callbacks.
416
417
  * @returns The parsed result value, or the return value of `onHelp`/`onError`
417
418
  * callbacks.
418
- * @throws {RunError} When parsing fails and no `onError` callback is provided.
419
+ * @throws {RunParserError} When parsing fails and no `onError` callback is
420
+ * provided.
419
421
  */
420
- function run(parser, programName, args, options = {}) {
422
+ function runParser(parser, programName, args, options = {}) {
421
423
  let { colors, maxWidth, showDefault, aboveError = "usage", onError = () => {
422
- throw new RunError("Failed to parse command line arguments.");
424
+ throw new RunParserError("Failed to parse command line arguments.");
423
425
  }, stderr = console.error, stdout = console.log, brief, description, footer } = options;
424
426
  const helpMode = options.help?.mode ?? "option";
425
427
  const onHelp = options.help?.onShow ?? (() => ({}));
@@ -457,7 +459,7 @@ function run(parser, programName, args, options = {}) {
457
459
  } : createCompletionParser(completion, programName, availableShells, completionName);
458
460
  if (options.completion) {
459
461
  const hasHelpOption = args.includes("--help");
460
- if ((completionMode === "command" || completionMode === "both") && args.length >= 1 && ((completionName === "singular" || completionName === "both" ? args[0] === "completion" : false) || (completionName === "plural" || completionName === "both" ? args[0] === "completions" : false)) && !hasHelpOption) return handleCompletion(args.slice(1), programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode);
462
+ if ((completionMode === "command" || completionMode === "both") && args.length >= 1 && ((completionName === "singular" || completionName === "both" ? args[0] === "completion" : false) || (completionName === "plural" || completionName === "both" ? args[0] === "completions" : false)) && !hasHelpOption) return handleCompletion(args.slice(1), programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName);
461
463
  if (completionMode === "option" || completionMode === "both") for (let i = 0; i < args.length; i++) {
462
464
  const arg = args[i];
463
465
  const singularMatch = completionName === "singular" || completionName === "both" ? arg.startsWith("--completion=") : false;
@@ -465,14 +467,14 @@ function run(parser, programName, args, options = {}) {
465
467
  if (singularMatch || pluralMatch) {
466
468
  const shell = arg.slice(arg.indexOf("=") + 1);
467
469
  const completionArgs = args.slice(i + 1);
468
- return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode);
470
+ return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName);
469
471
  } else {
470
472
  const singularMatchExact = completionName === "singular" || completionName === "both" ? arg === "--completion" : false;
471
473
  const pluralMatchExact = completionName === "plural" || completionName === "both" ? arg === "--completions" : false;
472
474
  if ((singularMatchExact || pluralMatchExact) && i + 1 < args.length) {
473
475
  const shell = args[i + 1];
474
476
  const completionArgs = args.slice(i + 2);
475
- return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode);
477
+ return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName);
476
478
  }
477
479
  }
478
480
  }
@@ -489,7 +491,7 @@ function run(parser, programName, args, options = {}) {
489
491
  } catch {
490
492
  return onVersion();
491
493
  }
492
- case "completion": throw new RunError("Completion should be handled by early return");
494
+ case "completion": throw new RunParserError("Completion should be handled by early return");
493
495
  case "help": {
494
496
  let helpGeneratorParser;
495
497
  const helpAsCommand = help === "command" || help === "both";
@@ -565,23 +567,37 @@ function run(parser, programName, args, options = {}) {
565
567
  stderr(`Error: ${errorMessage}`);
566
568
  return onError(1);
567
569
  }
568
- default: throw new RunError("Unexpected parse result type");
570
+ default: throw new RunParserError("Unexpected parse result type");
569
571
  }
570
572
  }
571
573
  /**
574
+ * @deprecated Use `runParser()` instead. This export will be removed in
575
+ * a future major version. The name `run` conflicts with
576
+ * `@optique/run`'s `run()` function, causing IDE autocomplete
577
+ * confusion.
578
+ */
579
+ const run = runParser;
580
+ /**
572
581
  * An error class used to indicate that the command line arguments
573
582
  * could not be parsed successfully.
574
583
  */
575
- var RunError = class extends Error {
584
+ var RunParserError = class extends Error {
576
585
  constructor(message$1) {
577
586
  super(message$1);
578
- this.name = "RunError";
587
+ this.name = "RunParserError";
579
588
  }
580
589
  };
590
+ /**
591
+ * @deprecated Use `RunParserError` instead. This export will be removed in
592
+ * a future major version.
593
+ */
594
+ const RunError = RunParserError;
581
595
  function indentLines(text$1, indent) {
582
596
  return text$1.split("\n").join("\n" + " ".repeat(indent));
583
597
  }
584
598
 
585
599
  //#endregion
586
600
  exports.RunError = RunError;
587
- exports.run = run;
601
+ exports.RunParserError = RunParserError;
602
+ exports.run = run;
603
+ exports.runParser = runParser;
package/dist/facade.d.cts CHANGED
@@ -211,15 +211,28 @@ interface RunOptions<THelp, TError> {
211
211
  * @param options Configuration options for output formatting and callbacks.
212
212
  * @returns The parsed result value, or the return value of `onHelp`/`onError`
213
213
  * callbacks.
214
- * @throws {RunError} When parsing fails and no `onError` callback is provided.
214
+ * @throws {RunParserError} When parsing fails and no `onError` callback is
215
+ * provided.
215
216
  */
216
- declare function run<TParser extends Parser<unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, args: readonly string[], options?: RunOptions<THelp, TError>): InferValue<TParser>;
217
+ declare function runParser<TParser extends Parser<unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, args: readonly string[], options?: RunOptions<THelp, TError>): InferValue<TParser>;
218
+ /**
219
+ * @deprecated Use `runParser()` instead. This export will be removed in
220
+ * a future major version. The name `run` conflicts with
221
+ * `@optique/run`'s `run()` function, causing IDE autocomplete
222
+ * confusion.
223
+ */
224
+ declare const run: typeof runParser;
217
225
  /**
218
226
  * An error class used to indicate that the command line arguments
219
227
  * could not be parsed successfully.
220
228
  */
221
- declare class RunError extends Error {
229
+ declare class RunParserError extends Error {
222
230
  constructor(message: string);
223
231
  }
232
+ /**
233
+ * @deprecated Use `RunParserError` instead. This export will be removed in
234
+ * a future major version.
235
+ */
236
+ declare const RunError: typeof RunParserError;
224
237
  //#endregion
225
- export { RunError, RunOptions, run };
238
+ export { RunError, RunOptions, RunParserError, run, runParser };
package/dist/facade.d.ts CHANGED
@@ -211,15 +211,28 @@ interface RunOptions<THelp, TError> {
211
211
  * @param options Configuration options for output formatting and callbacks.
212
212
  * @returns The parsed result value, or the return value of `onHelp`/`onError`
213
213
  * callbacks.
214
- * @throws {RunError} When parsing fails and no `onError` callback is provided.
214
+ * @throws {RunParserError} When parsing fails and no `onError` callback is
215
+ * provided.
215
216
  */
216
- declare function run<TParser extends Parser<unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, args: readonly string[], options?: RunOptions<THelp, TError>): InferValue<TParser>;
217
+ declare function runParser<TParser extends Parser<unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, args: readonly string[], options?: RunOptions<THelp, TError>): InferValue<TParser>;
218
+ /**
219
+ * @deprecated Use `runParser()` instead. This export will be removed in
220
+ * a future major version. The name `run` conflicts with
221
+ * `@optique/run`'s `run()` function, causing IDE autocomplete
222
+ * confusion.
223
+ */
224
+ declare const run: typeof runParser;
217
225
  /**
218
226
  * An error class used to indicate that the command line arguments
219
227
  * could not be parsed successfully.
220
228
  */
221
- declare class RunError extends Error {
229
+ declare class RunParserError extends Error {
222
230
  constructor(message: string);
223
231
  }
232
+ /**
233
+ * @deprecated Use `RunParserError` instead. This export will be removed in
234
+ * a future major version.
235
+ */
236
+ declare const RunError: typeof RunParserError;
224
237
  //#endregion
225
- export { RunError, RunOptions, run };
238
+ export { RunError, RunOptions, RunParserError, run, runParser };
package/dist/facade.js CHANGED
@@ -343,7 +343,7 @@ function classifyResult(result, args) {
343
343
  * Handles shell completion requests.
344
344
  * @since 0.6.0
345
345
  */
346
- function handleCompletion(completionArgs, programName, parser, completionParser, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode) {
346
+ function handleCompletion(completionArgs, programName, parser, completionParser, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName) {
347
347
  const shellName = completionArgs[0] || "";
348
348
  const args = completionArgs.slice(1);
349
349
  if (!shellName) {
@@ -375,7 +375,8 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
375
375
  return onError(1);
376
376
  }
377
377
  if (args.length === 0) {
378
- const completionArg = completionMode === "option" ? "--completion" : "completion";
378
+ const usePlural = completionName === "plural";
379
+ const completionArg = completionMode === "option" ? usePlural ? "--completions" : "--completion" : usePlural ? "completions" : "completion";
379
380
  const script = shell.generateScript(programName, [completionArg, shellName]);
380
381
  stdout(script);
381
382
  } else {
@@ -415,11 +416,12 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
415
416
  * @param options Configuration options for output formatting and callbacks.
416
417
  * @returns The parsed result value, or the return value of `onHelp`/`onError`
417
418
  * callbacks.
418
- * @throws {RunError} When parsing fails and no `onError` callback is provided.
419
+ * @throws {RunParserError} When parsing fails and no `onError` callback is
420
+ * provided.
419
421
  */
420
- function run(parser, programName, args, options = {}) {
422
+ function runParser(parser, programName, args, options = {}) {
421
423
  let { colors, maxWidth, showDefault, aboveError = "usage", onError = () => {
422
- throw new RunError("Failed to parse command line arguments.");
424
+ throw new RunParserError("Failed to parse command line arguments.");
423
425
  }, stderr = console.error, stdout = console.log, brief, description, footer } = options;
424
426
  const helpMode = options.help?.mode ?? "option";
425
427
  const onHelp = options.help?.onShow ?? (() => ({}));
@@ -457,7 +459,7 @@ function run(parser, programName, args, options = {}) {
457
459
  } : createCompletionParser(completion, programName, availableShells, completionName);
458
460
  if (options.completion) {
459
461
  const hasHelpOption = args.includes("--help");
460
- if ((completionMode === "command" || completionMode === "both") && args.length >= 1 && ((completionName === "singular" || completionName === "both" ? args[0] === "completion" : false) || (completionName === "plural" || completionName === "both" ? args[0] === "completions" : false)) && !hasHelpOption) return handleCompletion(args.slice(1), programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode);
462
+ if ((completionMode === "command" || completionMode === "both") && args.length >= 1 && ((completionName === "singular" || completionName === "both" ? args[0] === "completion" : false) || (completionName === "plural" || completionName === "both" ? args[0] === "completions" : false)) && !hasHelpOption) return handleCompletion(args.slice(1), programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName);
461
463
  if (completionMode === "option" || completionMode === "both") for (let i = 0; i < args.length; i++) {
462
464
  const arg = args[i];
463
465
  const singularMatch = completionName === "singular" || completionName === "both" ? arg.startsWith("--completion=") : false;
@@ -465,14 +467,14 @@ function run(parser, programName, args, options = {}) {
465
467
  if (singularMatch || pluralMatch) {
466
468
  const shell = arg.slice(arg.indexOf("=") + 1);
467
469
  const completionArgs = args.slice(i + 1);
468
- return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode);
470
+ return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName);
469
471
  } else {
470
472
  const singularMatchExact = completionName === "singular" || completionName === "both" ? arg === "--completion" : false;
471
473
  const pluralMatchExact = completionName === "plural" || completionName === "both" ? arg === "--completions" : false;
472
474
  if ((singularMatchExact || pluralMatchExact) && i + 1 < args.length) {
473
475
  const shell = args[i + 1];
474
476
  const completionArgs = args.slice(i + 2);
475
- return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode);
477
+ return handleCompletion([shell, ...completionArgs], programName, parser, completionParsers.completionCommand, stdout, stderr, onCompletion, onError, availableShells, colors, maxWidth, completionMode, completionName);
476
478
  }
477
479
  }
478
480
  }
@@ -489,7 +491,7 @@ function run(parser, programName, args, options = {}) {
489
491
  } catch {
490
492
  return onVersion();
491
493
  }
492
- case "completion": throw new RunError("Completion should be handled by early return");
494
+ case "completion": throw new RunParserError("Completion should be handled by early return");
493
495
  case "help": {
494
496
  let helpGeneratorParser;
495
497
  const helpAsCommand = help === "command" || help === "both";
@@ -565,22 +567,34 @@ function run(parser, programName, args, options = {}) {
565
567
  stderr(`Error: ${errorMessage}`);
566
568
  return onError(1);
567
569
  }
568
- default: throw new RunError("Unexpected parse result type");
570
+ default: throw new RunParserError("Unexpected parse result type");
569
571
  }
570
572
  }
571
573
  /**
574
+ * @deprecated Use `runParser()` instead. This export will be removed in
575
+ * a future major version. The name `run` conflicts with
576
+ * `@optique/run`'s `run()` function, causing IDE autocomplete
577
+ * confusion.
578
+ */
579
+ const run = runParser;
580
+ /**
572
581
  * An error class used to indicate that the command line arguments
573
582
  * could not be parsed successfully.
574
583
  */
575
- var RunError = class extends Error {
584
+ var RunParserError = class extends Error {
576
585
  constructor(message$1) {
577
586
  super(message$1);
578
- this.name = "RunError";
587
+ this.name = "RunParserError";
579
588
  }
580
589
  };
590
+ /**
591
+ * @deprecated Use `RunParserError` instead. This export will be removed in
592
+ * a future major version.
593
+ */
594
+ const RunError = RunParserError;
581
595
  function indentLines(text$1, indent) {
582
596
  return text$1.split("\n").join("\n" + " ".repeat(indent));
583
597
  }
584
598
 
585
599
  //#endregion
586
- export { RunError, run };
600
+ export { RunError, RunParserError, run, runParser };
package/dist/index.cjs CHANGED
@@ -11,6 +11,7 @@ const require_facade = require('./facade.cjs');
11
11
 
12
12
  exports.DuplicateOptionError = require_constructs.DuplicateOptionError;
13
13
  exports.RunError = require_facade.RunError;
14
+ exports.RunParserError = require_facade.RunParserError;
14
15
  exports.WithDefaultError = require_modifiers.WithDefaultError;
15
16
  exports.argument = require_primitives.argument;
16
17
  exports.bash = require_completion.bash;
@@ -54,6 +55,7 @@ exports.parse = require_parser.parse;
54
55
  exports.passThrough = require_primitives.passThrough;
55
56
  exports.pwsh = require_completion.pwsh;
56
57
  exports.run = require_facade.run;
58
+ exports.runParser = require_facade.runParser;
57
59
  exports.string = require_valueparser.string;
58
60
  exports.suggest = require_parser.suggest;
59
61
  exports.text = require_message.text;
package/dist/index.d.cts CHANGED
@@ -7,5 +7,5 @@ import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOpti
7
7
  import { DocState, InferValue, Parser, ParserContext, ParserResult, Result, Suggestion, getDocPage, parse, suggest } from "./parser.cjs";
8
8
  import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.cjs";
9
9
  import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.cjs";
10
- import { RunError, RunOptions, run } from "./facade.cjs";
11
- export { ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, Message, MessageFormatOptions, MessageTerm, MultipleErrorOptions, MultipleOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, Result, RunError, RunOptions, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, passThrough, pwsh, run, string, suggest, text, tuple, url, uuid, value, values, withDefault, zsh };
10
+ import { RunError, RunOptions, RunParserError, run, runParser } from "./facade.cjs";
11
+ export { ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, Message, MessageFormatOptions, MessageTerm, MultipleErrorOptions, MultipleOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, Result, RunError, RunOptions, RunParserError, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, passThrough, pwsh, run, runParser, string, suggest, text, tuple, url, uuid, value, values, withDefault, zsh };
package/dist/index.d.ts CHANGED
@@ -7,5 +7,5 @@ import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOpti
7
7
  import { DocState, InferValue, Parser, ParserContext, ParserResult, Result, Suggestion, getDocPage, parse, suggest } from "./parser.js";
8
8
  import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.js";
9
9
  import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.js";
10
- import { RunError, RunOptions, run } from "./facade.js";
11
- export { ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, Message, MessageFormatOptions, MessageTerm, MultipleErrorOptions, MultipleOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, Result, RunError, RunOptions, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, passThrough, pwsh, run, string, suggest, text, tuple, url, uuid, value, values, withDefault, zsh };
10
+ import { RunError, RunOptions, RunParserError, run, runParser } from "./facade.js";
11
+ export { ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, Message, MessageFormatOptions, MessageTerm, MultipleErrorOptions, MultipleOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OrErrorOptions, OrOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, Result, RunError, RunOptions, RunParserError, ShellCompletion, ShowDefaultOptions, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, WithDefaultError, WithDefaultOptions, argument, bash, choice, command, commandLine, concat, conditional, constant, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, passThrough, pwsh, run, runParser, string, suggest, text, tuple, url, uuid, value, values, withDefault, zsh };
package/dist/index.js CHANGED
@@ -7,6 +7,6 @@ import { WithDefaultError, map, multiple, optional, withDefault } from "./modifi
7
7
  import { choice, float, integer, isValueParser, locale, string, url, uuid } from "./valueparser.js";
8
8
  import { argument, command, constant, flag, option, passThrough } from "./primitives.js";
9
9
  import { getDocPage, parse, suggest } from "./parser.js";
10
- import { RunError, run } from "./facade.js";
10
+ import { RunError, RunParserError, run, runParser } from "./facade.js";
11
11
 
12
- export { DuplicateOptionError, RunError, WithDefaultError, argument, bash, choice, command, commandLine, concat, conditional, constant, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, passThrough, pwsh, run, string, suggest, text, tuple, url, uuid, value, values, withDefault, zsh };
12
+ export { DuplicateOptionError, RunError, RunParserError, WithDefaultError, argument, bash, choice, command, commandLine, concat, conditional, constant, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getDocPage, group, integer, isValueParser, locale, longestMatch, map, merge, message, metavar, multiple, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, passThrough, pwsh, run, runParser, string, suggest, text, tuple, url, uuid, value, values, withDefault, zsh };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.9.0-dev.172+ab781f75",
3
+ "version": "0.9.0-dev.176+1350294a",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",