@optique/core 1.3.0-dev.2589 → 1.3.1

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.
@@ -527,19 +527,17 @@ function option(...args) {
527
527
  const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
528
528
  for (const prefix of prefixes) {
529
529
  if (!context.buffer[0].startsWith(prefix)) continue;
530
- if (hasParsedOptionValue(context.state, valueParser)) {
531
- const optionName$1 = prefix.slice(0, -1);
532
- return {
533
- success: false,
534
- consumed: 1,
535
- 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.`
536
- };
537
- }
530
+ const optionName$1 = prefix.slice(0, -1);
531
+ if (hasParsedOptionValue(context.state, valueParser)) return {
532
+ success: false,
533
+ consumed: 1,
534
+ 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.`
535
+ };
538
536
  const rawInput = context.buffer[0].slice(prefix.length);
539
537
  if (valueParser == null) return {
540
538
  success: false,
541
539
  consumed: 1,
542
- 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}.`
540
+ 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}.`
543
541
  };
544
542
  return require_mode_dispatch.dispatchByMode(mode, () => {
545
543
  const parseResult = syncValueParser.parse(rawInput);
@@ -527,19 +527,17 @@ function option(...args) {
527
527
  const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
528
528
  for (const prefix of prefixes) {
529
529
  if (!context.buffer[0].startsWith(prefix)) continue;
530
- if (hasParsedOptionValue(context.state, valueParser)) {
531
- const optionName$1 = prefix.slice(0, -1);
532
- return {
533
- success: false,
534
- consumed: 1,
535
- 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.`
536
- };
537
- }
530
+ const optionName$1 = prefix.slice(0, -1);
531
+ if (hasParsedOptionValue(context.state, valueParser)) return {
532
+ success: false,
533
+ consumed: 1,
534
+ 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.`
535
+ };
538
536
  const rawInput = context.buffer[0].slice(prefix.length);
539
537
  if (valueParser == null) return {
540
538
  success: false,
541
539
  consumed: 1,
542
- 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}.`
540
+ 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}.`
543
541
  };
544
542
  return dispatchByMode(mode, () => {
545
543
  const parseResult = syncValueParser.parse(rawInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.3.0-dev.2589",
3
+ "version": "1.3.1",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -237,7 +237,7 @@
237
237
  },
238
238
  "sideEffects": false,
239
239
  "devDependencies": {
240
- "@optique/env": "1.3.0-dev.2589+3608b288",
240
+ "@optique/env": "1.3.1",
241
241
  "@types/node": "^24.0.0",
242
242
  "fast-check": "^4.7.0",
243
243
  "tsdown": "^0.13.0",