@optique/core 1.0.11-dev.2654 → 1.0.11

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.
@@ -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 = /^--?[a-z0-9-]+$/i;
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
- if (context.buffer[i] === "--") {
989
- optionsTerminated = true;
990
- i++;
991
- } else if (context.buffer[i].match(optionPattern)) return {
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(context.buffer[i])}.`
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 {
@@ -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 = /^--?[a-z0-9-]+$/i;
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
- if (context.buffer[i] === "--") {
989
- optionsTerminated = true;
990
- i++;
991
- } else if (context.buffer[i].match(optionPattern)) return {
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(context.buffer[i])}.`
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.11-dev.2654",
3
+ "version": "1.0.11",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",