@optique/core 1.0.8 → 1.0.10-dev.2593
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/dist/primitives.cjs +7 -9
- package/dist/primitives.js +7 -9
- package/package.json +1 -1
package/dist/primitives.cjs
CHANGED
|
@@ -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
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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(
|
|
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);
|
package/dist/primitives.js
CHANGED
|
@@ -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
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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(
|
|
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);
|