mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-31 06:04:11 +01:00
Tighten CI helper argument validation
This commit is contained in:
1 parent
1bc0363aed
commit
4bd884aa18
2 files changed
+8
-4
No files matched your search
@@ -36,6 +36,10 @@ function listWorkspacePackages() {
|
||||
encoding: "utf8",
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
fail(`Unable to spawn pnpm to list workspace packages: ${result.error.message}`);
|
||||
}
|
||||
|
||||
if (result.status !== 0) {
|
||||
fail("Unable to list pnpm workspace packages.");
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ function readOptionValue(argv, index, argName) {
|
||||
}
|
||||
|
||||
function parseNonNegativeInteger(value, argName) {
|
||||
const parsed = Number.parseInt(value, 10);
|
||||
if (!Number.isInteger(parsed) || parsed < 0) {
|
||||
const parsed = Number(value);
|
||||
if (value.trim() === "" || !Number.isInteger(parsed) || parsed < 0) {
|
||||
fail(`${argName} must be a non-negative integer. Received "${value}".`);
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ function parseNonNegativeInteger(value, argName) {
|
||||
}
|
||||
|
||||
function parsePositiveInteger(value, argName) {
|
||||
const parsed = Number.parseInt(value, 10);
|
||||
if (!Number.isInteger(parsed) || parsed < 1) {
|
||||
const parsed = Number(value);
|
||||
if (value.trim() === "" || !Number.isInteger(parsed) || parsed < 1) {
|
||||
fail(`${argName} must be a positive integer. Received "${value}".`);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user