mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
fix(scripts): reject short flag docker package values
This commit is contained in:
parent
ebb670b208
commit
6daf9307e0
2 changed files with 4 additions and 2 deletions
|
|
@ -67,14 +67,14 @@ function resolveTimeoutMs(envName, defaultValue) {
|
|||
|
||||
function readOptionValue(argv, index, optionName) {
|
||||
const value = argv[index + 1];
|
||||
if (value === undefined || value === "" || value.startsWith("--")) {
|
||||
if (value === undefined || value === "" || value.startsWith("-")) {
|
||||
throw new Error(`${optionName} requires a value`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function readEqualsOptionValue(value, optionName) {
|
||||
if (value === "" || value.startsWith("--")) {
|
||||
if (value === "" || value.startsWith("-")) {
|
||||
throw new Error(`${optionName} requires a value`);
|
||||
}
|
||||
return value;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ describe("package-openclaw-for-docker", () => {
|
|||
for (const flag of ["--output-dir", "--output-name", "--source-dir"]) {
|
||||
expect(() => parseArgs([flag])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([flag, "--skip-build"])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([flag, "-h"])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([`${flag}=`])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([`${flag}=-h`])).toThrow(`${flag} requires a value`);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue