fix(qa): reject duplicate gateway restart controls · openclaw/openclaw@a822c9a
vincentkoc
·
2026-06-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -253,12 +253,19 @@ function readRequiredFlagValue(argv: string[], index: number, flag: string): str
|
253 | 253 | } |
254 | 254 | |
255 | 255 | function validateCliArgs(argv: string[]): void { |
| 256 | +const seenSingleValueFlags = new Set<string>(); |
256 | 257 | for (let index = 0; index < argv.length; index += 1) { |
257 | 258 | const arg = argv[index] ?? ""; |
258 | 259 | if (BOOLEAN_FLAGS.has(arg)) { |
259 | 260 | continue; |
260 | 261 | } |
261 | 262 | if (VALUE_FLAGS.has(arg)) { |
| 263 | +if (arg !== "--case") { |
| 264 | +if (seenSingleValueFlags.has(arg)) { |
| 265 | +throw new CliArgumentError(`${arg} was provided more than once`); |
| 266 | +} |
| 267 | +seenSingleValueFlags.add(arg); |
| 268 | +} |
262 | 269 | readRequiredFlagValue(argv, index, arg); |
263 | 270 | index += 1; |
264 | 271 | continue; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -90,6 +90,9 @@ describe("gateway restart benchmark script", () => {
|
90 | 90 | expect(() => testing.parseOptions(["--output", "--case", "skipChannels"])).toThrow( |
91 | 91 | "--output requires a value", |
92 | 92 | ); |
| 93 | +expect(() => |
| 94 | +testing.parseOptions(["--output", "first.json", "--output", "second.json"]), |
| 95 | +).toThrow("--output was provided more than once"); |
93 | 96 | expect(() => testing.parseOptions(["--case"])).toThrow("--case requires a value"); |
94 | 97 | expect(() => |
95 | 98 | testing.parseOptions(["--case", "skipChannels", "--case", "skipChannels"]), |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。