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.

Copy the shell startup lines with the rest of a removal's details

Țugui Dragoș827d4f97fce1
diff --git a/Peel/Views/RemovalFailureAlert.swift b/Peel/Views/RemovalFailureAlert.swift
index 643289a6..92251c9f 100644
--- a/Peel/Views/RemovalFailureAlert.swift
+++ b/Peel/Views/RemovalFailureAlert.swift
@@ -156,8 +156,8 @@ struct RemovalFailureAlert: ViewModifier {
static func details(for outcome: RemovalOutcome) -> String {
var lines = quitLines(outcome) + outcome.failures.map { "\($0.url.path(percentEncoded: false))\n\($0.reason.explanation)" }
- + keptLines(outcome) + driverLines(outcome) + administratorLines(outcome) + appManagementLines(outcome)
- + privacyLines(outcome)
+ + keptLines(outcome) + driverLines(outcome) + administratorLines(outcome) + shellLines(outcome)
+ + appManagementLines(outcome) + privacyLines(outcome)
if #available(macOS 27, *) {
lines += trashLines(outcome) { $0.formatted(.list(type: .and)) }
}
diff --git a/PeelTests/RemovalFailureAlertTests.swift b/PeelTests/RemovalFailureAlertTests.swift
index 3c5b3d46..b2d1b009 100644
--- a/PeelTests/RemovalFailureAlertTests.swift
+++ b/PeelTests/RemovalFailureAlertTests.swift
@@ -25,4 +25,16 @@ struct RemovalFailureAlertTests {
let details = RemovalFailureAlert.details(for: outcome).components(separatedBy: "\n\n")
#expect(details.filter { $0.contains("Example 30") }.count == 3)
}
+
+ @Test func copiesTheShellLineTheAlertShows() {
+ let outcome = RemovalOutcome()
+ outcome.report(
+ TrashResult(failures: [TrashFailure(url: URL(filePath: "/Applications/Example.app"), reason: .locked)]),
+ shellReferences: [ShellReferences.Reference(file: URL(filePath: "/Users/someone/.zshrc"), line: 12)]
+ )
+ let shown = RemovalFailureAlert.message(for: outcome).components(separatedBy: "\n\n")
+ let line = shown.first { $0.contains("/Users/someone/.zshrc") }
+ #expect(line != nil)
+ #expect(RemovalFailureAlert.details(for: outcome).components(separatedBy: "\n\n").contains(line ?? ""))
+ }
}