mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-07 10:34:44 +00:00
fix(scripts): reject short flag values in release docs parsers
This commit is contained in:
@@ -83,7 +83,7 @@ function parseArgs(argv) {
|
||||
|
||||
function readOptionValue(argv, index, option) {
|
||||
const value = argv[index + 1] ?? "";
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new Error(`Missing value for ${option}.`);
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -94,7 +94,7 @@ function parsePositiveIntegerArg(raw, label) {
|
||||
|
||||
function readRequiredValue(argv, index, label) {
|
||||
const value = argv[index + 1];
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new Error(`${label} requires a value`);
|
||||
}
|
||||
return value;
|
||||
@@ -116,7 +116,10 @@ export function parseArgs(argv) {
|
||||
continue;
|
||||
}
|
||||
if (part === "--max-errors") {
|
||||
maxErrors = parsePositiveIntegerArg(argv[index + 1], "--max-errors");
|
||||
maxErrors = parsePositiveIntegerArg(
|
||||
readRequiredValue(argv, index, "--max-errors"),
|
||||
"--max-errors",
|
||||
);
|
||||
index += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ function parseArgs(argv) {
|
||||
|
||||
function readOptionValue(argv, index, option) {
|
||||
const value = argv[index + 1] ?? "";
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new Error(`Missing value for ${option}.`);
|
||||
}
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user