fix(scripts): reject short flag ownership report values · openclaw/openclaw@2a8db1f
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -399,7 +399,7 @@ function printTextReport(report) {
|
399 | 399 | |
400 | 400 | function readArtifactPath(argv, index, optionName) { |
401 | 401 | const value = argv[index + 1]; |
402 | | -if (value === undefined || value === "" || value.startsWith("--")) { |
| 402 | +if (value === undefined || value === "" || value.startsWith("-")) { |
403 | 403 | throw new Error(`${optionName} requires a value`); |
404 | 404 | } |
405 | 405 | return value; |
@@ -423,7 +423,7 @@ export function parseArgs(argv) {
|
423 | 423 | } |
424 | 424 | if (arg === "--json") { |
425 | 425 | options.asJson = true; |
426 | | -if (argv[index + 1] && !argv[index + 1].startsWith("--")) { |
| 426 | +if (argv[index + 1] && !argv[index + 1].startsWith("-")) { |
427 | 427 | options.jsonPath = argv[++index]; |
428 | 428 | } |
429 | 429 | continue; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -42,6 +42,7 @@ describe("parseArgs", () => {
|
42 | 42 | it("rejects missing markdown artifact paths", () => { |
43 | 43 | expect(() => parseArgs(["--markdown"])).toThrow("--markdown requires a value"); |
44 | 44 | expect(() => parseArgs(["--markdown", "--json"])).toThrow("--markdown requires a value"); |
| 45 | +expect(() => parseArgs(["--markdown", "-h"])).toThrow("--markdown requires a value"); |
45 | 46 | expect(() => parseArgs(["--markdown", ""])).toThrow("--markdown requires a value"); |
46 | 47 | }); |
47 | 48 | |
@@ -54,6 +55,7 @@ describe("parseArgs", () => {
|
54 | 55 | asJson: true, |
55 | 56 | jsonPath: "report.json", |
56 | 57 | }); |
| 58 | +expect(() => parseArgs(["--json", "-h"])).toThrow("Unsupported argument: -h"); |
57 | 59 | }); |
58 | 60 | }); |
59 | 61 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。