Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Name only the first apps to quit and shell lines in the alert after a removal
Țugui Dragoș30b01d00ef6e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8d8e8edd..eb793b57 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -145,8 +145,9 @@ its changes the way [Keep a Changelog](https://keepachangelog.com/) suggests.#### Applications- When many apps stay after a removal, as without App Management, the alert names the first few and counts the others,- so its Open System Settings button stays on the screen; Copy Details, offered whenever the alert names only the first- few, gives every app. Several apps' question names the first few apps that go and that stay the same way.+ so its Open System Settings button stays on the screen. It does the same with the apps to quit and the lines of your+ shell startup files, and Copy Details, offered whenever the alert names only the first few, gives them all. Several+ apps' question names the first few apps that go and that stay the same way.- iPhone and iPad apps installed on the Mac from the App Store are checked for updates against their own listing, in thestore they came from, and Mac apps sold together with their iPhone version against their Mac listing; both read "Can'tcheck for updates" while the App Store listed their updates.diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex aba30284..b2bf7bc7 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -201058,6 +201058,346 @@}}},+ "^[%lld more line](inflect: true)" : {+ "localizations" : {+ "cs" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld další řádky"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld dalšího řádku"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld další řádek"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld dalších řádků"+ }+ }+ }+ }+ },+ "de" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "noch %lld Zeile"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "noch %lld Zeilen"+ }+ }+ }+ }+ },+ "es" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld de líneas más"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld línea más"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld líneas más"+ }+ }+ }+ }+ },+ "fr" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld d’autres lignes"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld autre ligne"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld autres lignes"+ }+ }+ }+ }+ },+ "it" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "altre %lld di righe"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "un’altra riga"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "altre %lld righe"+ }+ }+ }+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "その他%lld行"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "그 외 %lld줄"+ }+ },+ "nl" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld andere regel"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld andere regels"+ }+ }+ }+ }+ },+ "pl" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld wiersze"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld wierszy"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld wiersz"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld wiersza"+ }+ }+ }+ }+ },+ "pt" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "mais %lld de linhas"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "mais %lld linha"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "mais %lld linhas"+ }+ }+ }+ }+ },+ "ro" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "încă %lld linii"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "încă %lld linie"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "încă %lld de linii"+ }+ }+ }+ }+ },+ "ru" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld строки"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld строк"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld строка"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld строки"+ }+ }+ }+ }+ },+ "sv" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld rad till"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld rader till"+ }+ }+ }+ }+ },+ "tr" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld satır daha"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld satır daha"+ }+ }+ }+ }+ },+ "uk" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld рядки"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld рядків"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld рядок"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld рядка"+ }+ }+ }+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "其他%lld行"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "其他%lld行"+ }+ }+ }+ },"^[%lld package](inflect: true)." : {"localizations" : {"cs" : {diff --git a/Peel/Views/RemovalFailureAlert.swift b/Peel/Views/RemovalFailureAlert.swiftindex b89dc69a..bc647b5f 100644--- a/Peel/Views/RemovalFailureAlert.swift+++ b/Peel/Views/RemovalFailureAlert.swift@@ -19,9 +19,12 @@ struct RemovalFailureAlert: ViewModifier {/// Apps named in one sentence: the first ones, as many as an alert lists, and then how many the others are.static func listed(_ names: [String]) -> String {+ listed(names) { String(inflecting: "^[\($0) more app](inflect: true)") }+ }++ private static func listed(_ names: [String], others: (Int) -> String) -> String {guard names.count > mostListed else { return names.formatted(.list(type: .and)) }- let others = String(inflecting: "^[\(names.count - mostListed) more app](inflect: true)")- return (names.prefix(mostListed) + [others]).formatted(.list(type: .and))+ return (names.prefix(mostListed) + [others(names.count - mostListed)]).formatted(.list(type: .and))}@Environment(RemovalOutcome.self) private var outcome@@ -91,13 +94,14 @@ struct RemovalFailureAlert: ViewModifier {static func message(for outcome: RemovalOutcome) -> String {let listed = outcome.failures.prefix(mostListed)- var lines = quitLines(outcome) + listed.map { "\($0.url.abbreviatedPath)\n\($0.reason.explanation)" }+ var lines = shortened(quitLines(outcome)) + listed.map { "\($0.url.abbreviatedPath)\n\($0.reason.explanation)" }let rest = outcome.failures.count - listed.countif rest > 0 {lines.append(String(inflecting: "And ^[\(rest) more item](inflect: true)."))}lines += shortened(keptLines(outcome)) + driverLines(outcome) + administratorLines(outcome)- + shellLines(outcome) + appManagementLines(outcome) + shortened(privacyLines(outcome))+ + shellLines(outcome) { Self.listed($0) { String(inflecting: "^[\($0) more line](inflect: true)") } }+ + appManagementLines(outcome) + shortened(privacyLines(outcome))if #available(macOS 27, *) {lines += trashLines(outcome, naming: Self.listed)}@@ -113,11 +117,11 @@ struct RemovalFailureAlert: ViewModifier {}/// One line for the shell startup files that still name what moved: the person edits them, Peel never does.- private static func shellLines(_ outcome: RemovalOutcome) -> [String] {+ private static func shellLines(_ outcome: RemovalOutcome, naming: ([String]) -> String) -> [String] {let references = outcome.shellReferencesguard !references.isEmpty else { return [] }let places = references.map { String(localized: "\($0.file.abbreviatedPath), line \($0.line)") }- return [String(localized: "Your shell startup files still name what moved, at \(places.formatted(.list(type: .and))). Peel reads these files and never changes them.")]+ return [String(localized: "Your shell startup files still name what moved, at \(naming(places)). Peel reads these files and never changes them.")]}private static func driverLines(_ outcome: RemovalOutcome) -> [String] {@@ -162,8 +166,9 @@ 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) + shellLines(outcome)- + appManagementLines(outcome) + privacyLines(outcome)+ + keptLines(outcome) + driverLines(outcome) + administratorLines(outcome)+ + shellLines(outcome) { $0.formatted(.list(type: .and)) } + 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.swiftindex 364e8ac4..2e4153ec 100644--- a/PeelTests/RemovalFailureAlertTests.swift+++ b/PeelTests/RemovalFailureAlertTests.swift@@ -52,4 +52,22 @@ struct RemovalFailureAlertTests {few.report(TrashResult(), privacy: apps.prefix(2).map { ($0, .notKnownToTheSystem) })#expect(!RemovalFailureAlert.offersDetails(for: few))}++ @Test func namesTheFirstAppsToQuitAndShellLinesAndCountsTheOthers() {+ let outcome = RemovalOutcome()+ outcome.report(+ TrashResult(),+ appsToQuit: (1...6).map { "Example \($0)" },+ shellReferences: (1...6).map {+ ShellReferences.Reference(file: URL(filePath: "/Users/someone/.zshrc"), line: $0 * 10)+ }+ )+ let paragraphs = RemovalFailureAlert.message(for: outcome).components(separatedBy: "\n\n")+ #expect(paragraphs.filter { $0.contains("Example") }.count == RemovalFailureAlert.mostListed)+ let shell = paragraphs.first { $0.contains(".zshrc") } ?? ""+ #expect(shell.contains("40") && !shell.contains("50") && !shell.contains("60"), "\(shell)")+ let details = RemovalFailureAlert.details(for: outcome)+ #expect(details.contains("Example 6") && details.contains("60"))+ #expect(RemovalFailureAlert.offersDetails(for: outcome))+ }}