@optique/core 1.2.6 → 1.2.8

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.
@@ -521,19 +521,17 @@ function option(...args) {
521
521
  const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
522
522
  for (const prefix of prefixes) {
523
523
  if (!context.buffer[0].startsWith(prefix)) continue;
524
- if (hasParsedOptionValue(context.state, valueParser)) {
525
- const optionName$1 = prefix.slice(0, -1);
526
- return {
527
- success: false,
528
- consumed: 1,
529
- 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.`
530
- };
531
- }
524
+ const optionName$1 = prefix.slice(0, -1);
525
+ if (hasParsedOptionValue(context.state, valueParser)) return {
526
+ success: false,
527
+ consumed: 1,
528
+ 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.`
529
+ };
532
530
  const rawInput = context.buffer[0].slice(prefix.length);
533
531
  if (valueParser == null) return {
534
532
  success: false,
535
533
  consumed: 1,
536
- 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}.`
534
+ 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}.`
537
535
  };
538
536
  return require_mode_dispatch.dispatchByMode(mode, () => {
539
537
  const parseResult = syncValueParser.parse(rawInput);
@@ -521,19 +521,17 @@ function option(...args) {
521
521
  const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
522
522
  for (const prefix of prefixes) {
523
523
  if (!context.buffer[0].startsWith(prefix)) continue;
524
- if (hasParsedOptionValue(context.state, valueParser)) {
525
- const optionName$1 = prefix.slice(0, -1);
526
- return {
527
- success: false,
528
- consumed: 1,
529
- 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.`
530
- };
531
- }
524
+ const optionName$1 = prefix.slice(0, -1);
525
+ if (hasParsedOptionValue(context.state, valueParser)) return {
526
+ success: false,
527
+ consumed: 1,
528
+ 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.`
529
+ };
532
530
  const rawInput = context.buffer[0].slice(prefix.length);
533
531
  if (valueParser == null) return {
534
532
  success: false,
535
533
  consumed: 1,
536
- 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}.`
534
+ 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}.`
537
535
  };
538
536
  return dispatchByMode(mode, () => {
539
537
  const parseResult = syncValueParser.parse(rawInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -221,7 +221,7 @@
221
221
  },
222
222
  "sideEffects": false,
223
223
  "devDependencies": {
224
- "@optique/env": "1.2.6",
224
+ "@optique/env": "1.2.8",
225
225
  "@types/node": "^24.0.0",
226
226
  "fast-check": "^4.7.0",
227
227
  "tsdown": "^0.13.0",