fix(qa): reject duplicate gateway startup controls · openclaw/openclaw@c308295
vincentkoc
·
2026-06-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -206,12 +206,19 @@ function readRequiredFlagValue(argv: string[], index: number, flag: string): str
|
206 | 206 | } |
207 | 207 | |
208 | 208 | function validateCliArgs(argv: string[]): void { |
| 209 | +const seenSingleValueFlags = new Set<string>(); |
209 | 210 | for (let index = 0; index < argv.length; index += 1) { |
210 | 211 | const arg = argv[index] ?? ""; |
211 | 212 | if (BOOLEAN_FLAGS.has(arg)) { |
212 | 213 | continue; |
213 | 214 | } |
214 | 215 | if (VALUE_FLAGS.has(arg)) { |
| 216 | +if (arg !== "--case") { |
| 217 | +if (seenSingleValueFlags.has(arg)) { |
| 218 | +throw new CliArgumentError(`${arg} was provided more than once`); |
| 219 | +} |
| 220 | +seenSingleValueFlags.add(arg); |
| 221 | +} |
215 | 222 | readRequiredFlagValue(argv, index, arg); |
216 | 223 | index += 1; |
217 | 224 | continue; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -84,6 +84,9 @@ describe("gateway startup benchmark script", () => {
|
84 | 84 | expect(() => testing.parseOptions(["--case", "default", "--case", "default"])).toThrow( |
85 | 85 | 'Duplicate --case "default"', |
86 | 86 | ); |
| 87 | +expect(() => |
| 88 | +testing.parseOptions(["--output", "first.json", "--output", "second.json"]), |
| 89 | +).toThrow("--output was provided more than once"); |
87 | 90 | expect(() => testing.resolveEntry("--inspect")).toThrow(/must be a file path/u); |
88 | 91 | }); |
89 | 92 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。