@optique/core 1.0.9 → 1.0.10-dev.2595

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.
@@ -507,19 +507,17 @@ function option(...args) {
507
507
  const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
508
508
  for (const prefix of prefixes) {
509
509
  if (!context.buffer[0].startsWith(prefix)) continue;
510
- if (hasParsedOptionValue(context.state, valueParser)) {
511
- const optionName$1 = prefix.slice(0, -1);
512
- return {
513
- success: false,
514
- consumed: 1,
515
- error: options.errors?.duplicate ? typeof options.errors.duplicate === "function" ? options.errors.duplicate(prefix) : options.errors.duplicate : require_message.message`${require_message.optionName(optionName$1)} cannot be used multiple times.`
516
- };
517
- }
510
+ const optionName$1 = prefix.slice(0, -1);
511
+ if (hasParsedOptionValue(context.state, valueParser)) return {
512
+ success: false,
513
+ consumed: 1,
514
+ error: options.errors?.duplicate ? typeof options.errors.duplicate === "function" ? options.errors.duplicate(prefix) : options.errors.duplicate : require_message.message`${require_message.optionName(optionName$1)} cannot be used multiple times.`
515
+ };
518
516
  const rawInput = context.buffer[0].slice(prefix.length);
519
517
  if (valueParser == null) return {
520
518
  success: false,
521
519
  consumed: 1,
522
- error: options.errors?.unexpectedValue ? typeof options.errors.unexpectedValue === "function" ? options.errors.unexpectedValue(rawInput) : options.errors.unexpectedValue : require_message.message`Option ${require_message.optionName(prefix)} is a Boolean flag, but got a value: ${rawInput}.`
520
+ error: options.errors?.unexpectedValue ? typeof options.errors.unexpectedValue === "function" ? options.errors.unexpectedValue(rawInput) : options.errors.unexpectedValue : require_message.message`Option ${require_message.optionName(optionName$1)} is a Boolean flag, but got a value: ${rawInput}.`
523
521
  };
524
522
  return require_mode_dispatch.dispatchByMode(mode, () => {
525
523
  const parseResult = syncValueParser.parse(rawInput);
@@ -507,19 +507,17 @@ function option(...args) {
507
507
  const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
508
508
  for (const prefix of prefixes) {
509
509
  if (!context.buffer[0].startsWith(prefix)) continue;
510
- if (hasParsedOptionValue(context.state, valueParser)) {
511
- const optionName$1 = prefix.slice(0, -1);
512
- return {
513
- success: false,
514
- consumed: 1,
515
- error: options.errors?.duplicate ? typeof options.errors.duplicate === "function" ? options.errors.duplicate(prefix) : options.errors.duplicate : message`${optionName(optionName$1)} cannot be used multiple times.`
516
- };
517
- }
510
+ const optionName$1 = prefix.slice(0, -1);
511
+ if (hasParsedOptionValue(context.state, valueParser)) return {
512
+ success: false,
513
+ consumed: 1,
514
+ error: options.errors?.duplicate ? typeof options.errors.duplicate === "function" ? options.errors.duplicate(prefix) : options.errors.duplicate : message`${optionName(optionName$1)} cannot be used multiple times.`
515
+ };
518
516
  const rawInput = context.buffer[0].slice(prefix.length);
519
517
  if (valueParser == null) return {
520
518
  success: false,
521
519
  consumed: 1,
522
- error: options.errors?.unexpectedValue ? typeof options.errors.unexpectedValue === "function" ? options.errors.unexpectedValue(rawInput) : options.errors.unexpectedValue : message`Option ${optionName(prefix)} is a Boolean flag, but got a value: ${rawInput}.`
520
+ error: options.errors?.unexpectedValue ? typeof options.errors.unexpectedValue === "function" ? options.errors.unexpectedValue(rawInput) : options.errors.unexpectedValue : message`Option ${optionName(optionName$1)} is a Boolean flag, but got a value: ${rawInput}.`
523
521
  };
524
522
  return dispatchByMode(mode, () => {
525
523
  const parseResult = syncValueParser.parse(rawInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.9",
3
+ "version": "1.0.10-dev.2595",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",