args-tokens 0.17.0 → 0.17.1

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/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseArgs } from "./parser-Dr4iAGaX.js";
2
- import { ArgResolveError, resolveArgs } from "./resolver-pmWK3ioa.js";
2
+ import { ArgResolveError, resolveArgs } from "./resolver-DuUwC6Fy.js";
3
3
 
4
4
  //#region src/parse.ts
5
5
  const DEFAULT_OPTIONS = {
@@ -182,7 +182,7 @@ function resolveArgs(args, tokens, { optionGrouping = false, skipPositional = SK
182
182
  };
183
183
  }
184
184
  function createRequireError(option, schema) {
185
- const message = schema.type === "positional" ? `Positional argument '${option}' is required` : `Option '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}is required`;
185
+ const message = schema.type === "positional" ? `Positional argument '${option}' is required` : `Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}is required`;
186
186
  return new ArgResolveError(message, option, "required", schema);
187
187
  }
188
188
  /**
@@ -214,7 +214,7 @@ function validateValue(token, option, schema) {
214
214
  break;
215
215
  }
216
216
  case "enum": {
217
- if (schema.choices && !schema.choices.includes(token.value)) return new ArgResolveError(`Option '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}should be chosen from '${schema.type}' [${schema.choices.map((c) => JSON.stringify(c)).join(", ")}] values`, option, "type", schema);
217
+ if (schema.choices && !schema.choices.includes(token.value)) return new ArgResolveError(`Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}should be chosen from '${schema.type}' [${schema.choices.map((c) => JSON.stringify(c)).join(", ")}] values`, option, "type", schema);
218
218
  break;
219
219
  }
220
220
  }
@@ -223,7 +223,7 @@ function isNumeric(str) {
223
223
  return str.trim() !== "" && !isNaN(str);
224
224
  }
225
225
  function createTypeError(option, schema) {
226
- return new ArgResolveError(`Option '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}should be '${schema.type}'`, option, "type", schema);
226
+ return new ArgResolveError(`Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}should be '${schema.type}'`, option, "type", schema);
227
227
  }
228
228
  function resolveArgumentValue(token, schema) {
229
229
  if (token.value) return schema.type === "number" ? +token.value : token.value;
package/lib/resolver.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./parser-Dr4iAGaX.js";
2
- import { ArgResolveError, resolveArgs } from "./resolver-pmWK3ioa.js";
2
+ import { ArgResolveError, resolveArgs } from "./resolver-DuUwC6Fy.js";
3
3
 
4
4
  export { ArgResolveError, resolveArgs };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "args-tokens",
3
3
  "description": "parseArgs tokens compatibility and more high-performance parser",
4
- "version": "0.17.0",
4
+ "version": "0.17.1",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"