mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 11:55:47 -06:00
fix(qa): reject duplicate telegram proof controls
This commit is contained in:
@@ -326,13 +326,20 @@ export function parseArgs(argvInput: string[]): Options {
|
||||
argv = argv.slice(0, commandSeparator);
|
||||
}
|
||||
let expectWasPassed = false;
|
||||
const seenSingleValueOptions = new Set<string>();
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const arg = argv[index];
|
||||
const readValue = () => {
|
||||
const readValue = (options: { repeatable?: boolean } = {}) => {
|
||||
const value = argv[index + 1];
|
||||
if (isMissingOptionValue(value)) {
|
||||
usage();
|
||||
}
|
||||
if (!options.repeatable) {
|
||||
if (seenSingleValueOptions.has(arg)) {
|
||||
throw new Error(`${arg} was provided more than once`);
|
||||
}
|
||||
seenSingleValueOptions.add(arg);
|
||||
}
|
||||
index += 1;
|
||||
return value;
|
||||
};
|
||||
@@ -351,7 +358,7 @@ export function parseArgs(argvInput: string[]): Options {
|
||||
opts.expect = [];
|
||||
expectWasPassed = true;
|
||||
}
|
||||
opts.expect.push(readValue());
|
||||
opts.expect.push(readValue({ repeatable: true }));
|
||||
} else if (arg === "--gateway-port") {
|
||||
opts.gatewayPort = parseTcpPort(readValue(), "--gateway-port");
|
||||
} else if (arg === "--id") {
|
||||
|
||||
Reference in New Issue
Block a user