flashtrace 0.7.1 → 0.7.2

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.
@@ -901,25 +901,37 @@ Options:
901
901
  -V, --version print the version number
902
902
  -h, --help show this help
903
903
 
904
+ Long options also accept "="-attached values, e.g. --tags=a,b.
905
+
904
906
  Exit codes: 0 clean, 1 defects or problems found, 2 usage error`;
905
907
  function packageVersion() {
906
908
  const pkg = new URL("../package.json", import.meta.url);
907
909
  return JSON.parse(readFileSync(pkg, "utf8")).version;
908
910
  }
911
+ function splitLongOption(token) {
912
+ const eq = token.startsWith("--") ? token.indexOf("=") : -1;
913
+ return eq === -1 ? [token, null] : [token.slice(0, eq), token.slice(eq + 1)];
914
+ }
915
+ function rejectValue(name, inline) {
916
+ if (inline !== null) throw new UsageError(`option ${name} does not take a value`);
917
+ }
909
918
  function parseArgs(argv) {
910
919
  const opts = { dirs: [], tags: null, verbose: false };
911
920
  for (let i = 0; i < argv.length; i++) {
912
- const a = argv[i];
921
+ const [a, inline] = splitLongOption(argv[i]);
913
922
  if (a === "-h" || a === "--help") {
923
+ rejectValue(a, inline);
914
924
  console.log(HELP);
915
925
  process3.exit(0);
916
926
  } else if (a === "-v" || a === "--verbose") {
927
+ rejectValue(a, inline);
917
928
  opts.verbose = true;
918
929
  } else if (a === "-V" || a === "--version") {
930
+ rejectValue(a, inline);
919
931
  console.log(packageVersion());
920
932
  process3.exit(0);
921
933
  } else if (a === "-t" || a === "--tags") {
922
- const v = argv[++i];
934
+ const v = inline ?? argv[++i];
923
935
  if (!v) throw new UsageError(`missing value for ${a}`);
924
936
  opts.tags = v.split(",").map((s) => s.trim()).filter(Boolean);
925
937
  } else if (a.startsWith("-")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flashtrace",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Lightning-fast, reference-based requirement tracing that works anywhere.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {