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