Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

peel updates lists the apps whose check failed

Țugui Dragoșf6279ff2a127
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift
index 04970728..acefa287 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift
@@ -578,8 +578,9 @@ struct UpdatesCommand: AsyncParsableCommand {
let status = statuses[app.id] ?? .unsupported
if status != .unsupported { report.withAFeed += 1 }
if status == .failed { report.failed += 1 }
- // The same rule as the app's list: a skipped version is not a waiting update.
- if all || preferences.isWaiting(status, for: app) {
+ // The same rule as the app's list: a skipped version is not a waiting update. A check that failed is
+ // always listed, so a report with one is never read as all up to date.
+ if all || status == .failed || preferences.isWaiting(status, for: app) {
report.rows.append((app, status))
}
}
@@ -602,7 +603,7 @@ struct UpdatesCommand: AsyncParsableCommand {
try Output.json(report.rows.map { Record(app: $0.app, status: $0.status) })
} else if !report.rows.isEmpty {
Output.table([["NAME", "INSTALLED", "STATUS"]] + report.rows.map { [$0.app.name, $0.app.version ?? "", Self.summary($0.status)] })
- } else if !report.nothingAnswered {
+ } else {
Output.line("Every app with an update feed is up to date.")
}
if let note = homebrew.note {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
index 03fcd601..d5925470 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
@@ -614,8 +614,8 @@ struct CommandLineTests {
// MARK: peel updates
- /// When every check fails, as with no network, the report must not read as "every app is up to date": a
- /// script checking the result would take it as the all clear.
+ /// A check that failed is listed, in the table and in `--json`, so the report never reads as "every app is up to
+ /// date", which a script would take as the all clear, while some apps did not answer.
@Test func doesNotCallAFailedCheckAnAllClear() {
let editor = InstalledApp(url: URL(filePath: "/Applications/Editor.app", directoryHint: .isDirectory), bundleIdentifier: "com.example.editor", name: "Editor", version: "1.0")
let notes = InstalledApp(url: URL(filePath: "/Applications/Notes.app", directoryHint: .isDirectory), bundleIdentifier: "com.example.notes", name: "Notes", version: "2.0")
@@ -628,7 +628,7 @@ struct CommandLineTests {
preferences: UpdatePreferences(),
all: false
)
- #expect(nothing.rows.isEmpty)
+ #expect(nothing.rows.map(\.app.name) == ["Editor", "Notes"])
#expect(nothing.failed == 2)
#expect(nothing.withAFeed == 2)
#expect(nothing.nothingAnswered)
@@ -639,7 +639,7 @@ struct CommandLineTests {
preferences: UpdatePreferences(),
all: false
)
- #expect(some.rows.isEmpty)
+ #expect(some.rows.map(\.app.name) == ["Editor"])
#expect(some.failed == 1)
#expect(!some.nothingAnswered)
}