@optique/core 1.0.11-dev.2654 → 1.0.11-dev.2656
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 +8 -7
- package/dist/primitives.js +8 -7
- package/package.json +1 -1
package/dist/primitives.cjs
CHANGED
|
@@ -960,7 +960,7 @@ function argument(valueParser, options = {}) {
|
|
|
960
960
|
const syncValueParser = valueParser;
|
|
961
961
|
const dependencyMetadata = require_dependency_metadata.extractDependencyMetadata(valueParser);
|
|
962
962
|
const formatInvalidValueError = (error) => options.errors?.invalidValue ? typeof options.errors.invalidValue === "function" ? options.errors.invalidValue(error) : options.errors.invalidValue : require_message.message`${require_message.metavar(valueParser.metavar)}: ${error}`;
|
|
963
|
-
const optionPattern =
|
|
963
|
+
const optionPattern = /^(?!--=)(--?[a-z0-9-]+)(?:=|$)/i;
|
|
964
964
|
const term = {
|
|
965
965
|
type: "argument",
|
|
966
966
|
metavar: valueParser.metavar,
|
|
@@ -984,14 +984,15 @@ function argument(valueParser, options = {}) {
|
|
|
984
984
|
};
|
|
985
985
|
let i = 0;
|
|
986
986
|
let optionsTerminated = context.optionsTerminated;
|
|
987
|
-
if (!optionsTerminated) {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
987
|
+
if (!optionsTerminated) if (context.buffer[i] === "--") {
|
|
988
|
+
optionsTerminated = true;
|
|
989
|
+
i++;
|
|
990
|
+
} else {
|
|
991
|
+
const optionMatch = context.buffer[i].match(optionPattern);
|
|
992
|
+
if (optionMatch != null) return {
|
|
992
993
|
success: false,
|
|
993
994
|
consumed: i,
|
|
994
|
-
error: require_message.message`Expected an argument, but got an option: ${require_message.optionName(
|
|
995
|
+
error: require_message.message`Expected an argument, but got an option: ${require_message.optionName(optionMatch[1])}.`
|
|
995
996
|
};
|
|
996
997
|
}
|
|
997
998
|
if (context.buffer.length < i + 1) return {
|
package/dist/primitives.js
CHANGED
|
@@ -960,7 +960,7 @@ function argument(valueParser, options = {}) {
|
|
|
960
960
|
const syncValueParser = valueParser;
|
|
961
961
|
const dependencyMetadata = extractDependencyMetadata(valueParser);
|
|
962
962
|
const formatInvalidValueError = (error) => options.errors?.invalidValue ? typeof options.errors.invalidValue === "function" ? options.errors.invalidValue(error) : options.errors.invalidValue : message`${metavar(valueParser.metavar)}: ${error}`;
|
|
963
|
-
const optionPattern =
|
|
963
|
+
const optionPattern = /^(?!--=)(--?[a-z0-9-]+)(?:=|$)/i;
|
|
964
964
|
const term = {
|
|
965
965
|
type: "argument",
|
|
966
966
|
metavar: valueParser.metavar,
|
|
@@ -984,14 +984,15 @@ function argument(valueParser, options = {}) {
|
|
|
984
984
|
};
|
|
985
985
|
let i = 0;
|
|
986
986
|
let optionsTerminated = context.optionsTerminated;
|
|
987
|
-
if (!optionsTerminated) {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
987
|
+
if (!optionsTerminated) if (context.buffer[i] === "--") {
|
|
988
|
+
optionsTerminated = true;
|
|
989
|
+
i++;
|
|
990
|
+
} else {
|
|
991
|
+
const optionMatch = context.buffer[i].match(optionPattern);
|
|
992
|
+
if (optionMatch != null) return {
|
|
992
993
|
success: false,
|
|
993
994
|
consumed: i,
|
|
994
|
-
error: message`Expected an argument, but got an option: ${optionName(
|
|
995
|
+
error: message`Expected an argument, but got an option: ${optionName(optionMatch[1])}.`
|
|
995
996
|
};
|
|
996
997
|
}
|
|
997
998
|
if (context.buffer.length < i + 1) return {
|