Skip to content

Commit fca093c

Browse files
committed
cp dines
1 parent 4cc2cb9 commit fca093c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/commands/blueprint/prune.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function categorizeBlueprints(blueprints: Blueprint[], keepCount: number) {
7575
successful.sort((a, b) => (b.create_time_ms || 0) - (a.create_time_ms || 0));
7676

7777
// Determine what to keep and delete
78+
// keepCount of 0 means delete all (including successful builds)
7879
const toKeep = successful.slice(0, keepCount);
7980
const toDelete = [...successful.slice(keepCount), ...failed];
8081

@@ -136,7 +137,11 @@ function displaySummary(
136137
// Show what will be kept
137138
console.log(`\nKeeping (${result.toKeep.length} most recent successful):`);
138139
if (result.toKeep.length === 0) {
139-
console.log(" (none - no successful builds found)");
140+
if (result.successful.length === 0) {
141+
console.log(" (none - no successful builds found)");
142+
} else {
143+
console.log(" (none)");
144+
}
140145
} else {
141146
for (const blueprint of result.toKeep) {
142147
console.log(
@@ -241,8 +246,8 @@ export async function pruneBlueprints(
241246
const autoConfirm = options.yes || false;
242247
const keepCount = parseInt(options.keep || "1", 10);
243248

244-
if (isNaN(keepCount) || keepCount < 1) {
245-
outputError("--keep must be a positive integer");
249+
if (isNaN(keepCount) || keepCount < 0) {
250+
outputError("--keep must be a non-negative integer");
246251
}
247252

248253
// Fetch all blueprints with the given name

0 commit comments

Comments
 (0)