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 the first four formulae Clean Up uninstalls, and all of them in its note
Țugui Dragoș20e0f9156481
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 64db17ab..d5799d08 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -45589,6 +45589,112 @@"comment" : "Homebrew's own name for one of its two kinds of package, in the plural. It heads a section of the Homebrew page and labels a count there. Homebrew prints it in English whatever language the Mac uses, so it stays in English.","shouldTranslate" : false},+ "Formulae it would uninstall now: %@." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae, které by se teď odinstalovaly: %@."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae, die Homebrew jetzt deinstallieren würde: %@."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae que desinstalaría ahora: %@."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae qui seraient désinstallées maintenant : %@."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae che verrebbero disinstallate ora: %@."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "今実行した場合にアンインストールされるformulae: %@。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "지금 실행하면 제거될 formulae: %@."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae die nu zouden worden gedeïnstalleerd: %@."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae, które zostałyby teraz odinstalowane: %@."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae que seriam desinstaladas agora: %@."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulele pe care le‑ar dezinstala acum: %@."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Сейчас будут удалены formulae: %@."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Formulae som skulle avinstalleras nu: %@."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Temizle işleminin şimdi yüklemesini kaldıracağı formulae: %@."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Зараз було б деінстальовано такі formulae: %@."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "它现在会卸载的formulae:%@。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "它現在會解除安裝的formulae:%@。"+ }+ }+ }+ },"Found" : {"localizations" : {"cs" : {@@ -212454,6 +212560,346 @@}}},+ "^[%lld more formula](inflect: true)" : {+ "localizations" : {+ "cs" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld další formulae"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld další formulae"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld další formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld dalších formulae"+ }+ }+ }+ }+ },+ "de" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "noch %lld Formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "noch %lld Formulae"+ }+ }+ }+ }+ },+ "es" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld de formulae más"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld formula más"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld formulae más"+ }+ }+ }+ }+ },+ "fr" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld d’autres formulae"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld autre formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld autres formulae"+ }+ }+ }+ }+ },+ "it" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "altre %lld di formulae"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "un’altra formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "altre %lld formulae"+ }+ }+ }+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "その他%lld個のformula"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "그 외 formula %lld개"+ }+ },+ "nl" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld andere formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld andere formulae"+ }+ }+ }+ }+ },+ "pl" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld formulae"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld formulae"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "jeszcze %lld formulae"+ }+ }+ }+ }+ },+ "pt" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "mais %lld de formulae"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "mais %lld formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "mais %lld formulae"+ }+ }+ }+ }+ },+ "ro" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "încă %lld formule"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "încă %lld formulă"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "încă %lld de formule"+ }+ }+ }+ }+ },+ "ru" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld formulae"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld formulae"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "еще %lld formulae"+ }+ }+ }+ }+ },+ "sv" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld formula till"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld formulae till"+ }+ }+ }+ }+ },+ "tr" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld formula daha"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld formula daha"+ }+ }+ }+ }+ },+ "uk" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld formulae"+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld formulae"+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld formula"+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ще %lld formulae"+ }+ }+ }+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "其他%lld个formula"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "其他%lld個formula"+ }+ }+ }+ },"^[%lld more item](inflect: true)" : {"localizations" : {"cs" : {diff --git a/Peel/Views/Homebrew/HomebrewList.swift b/Peel/Views/Homebrew/HomebrewList.swiftindex 8eb75ad4..149cd1de 100644--- a/Peel/Views/Homebrew/HomebrewList.swift+++ b/Peel/Views/Homebrew/HomebrewList.swift@@ -137,11 +137,25 @@ struct HomebrewList: View {}let formulae = homebrew.autoremovableif !formulae.isEmpty {- sentences.append(String(inflecting: "It uninstalls ^[\(formulae.count) formula](inflect: true) that nothing needs anymore: \(formulae.formatted(.list(type: .and)))."))+ sentences.append(Self.uninstalls(formulae))}return sentences.joined(separator: "\n\n")}+ /// The formulae Clean Up uninstalls, the first ones named as an alert names them. The row's note has them all.+ static func uninstalls(_ formulae: [String]) -> String {+ String(inflecting: "It uninstalls ^[\(formulae.count) formula](inflect: true) that nothing needs anymore: \(RemovalFailureAlert.listedFormulae(formulae)).")+ }++ /// What the Clean Up row's note says: what Clean Up removes, and every formula it would uninstall now.+ private var cleanUpDetail: Text {+ let removes = Text("Removes what Homebrew kept after installing and upgrading: cached downloads, old versions, and formulae that were only there for something now gone. What you installed yourself stays.")+ let formulae = homebrew.autoremovable+ guard !formulae.isEmpty else { return removes }+ let listed = Text("Formulae it would uninstall now: \(formulae.formatted(.list(type: .and))).")+ return Text("\(removes)\n\n\(listed)")+ }+// MARK: - Homebrew itself/// What Homebrew's own settings undo of how Peel runs it, said before anything is run.@@ -205,7 +219,7 @@ struct HomebrewList: View {Section {row(title: "Update Homebrew",- detail: "Gets the newest Homebrew and its newest list of packages, so run it before looking for updates. It upgrades nothing, though Homebrew may move a renamed package to its new name, or reinstall pkgconf after a macOS update.",+ detail: Text("Gets the newest Homebrew and its newest list of packages, so run it before looking for updates. It upgrades nothing, though Homebrew may move a renamed package to its new name, or reinstall pkgconf after a macOS update."),systemImage: "arrow.triangle.2.circlepath",command: .update) {@@ -213,7 +227,7 @@ struct HomebrewList: View {}row(title: "Clean Up",- detail: "Removes what Homebrew kept after installing and upgrading: cached downloads, old versions, and formulae that were only there for something now gone. What you installed yourself stays.",+ detail: cleanUpDetail,systemImage: "sparkles",command: .cleanup) {@@ -227,7 +241,7 @@ struct HomebrewList: View {}row(title: "Clear Older Downloads",- detail: "Removes every file in Homebrew’s cache older than 30 days, as well as what Clean Up removes.",+ detail: Text("Removes every file in Homebrew’s cache older than 30 days, as well as what Clean Up removes."),systemImage: "clock.arrow.trianglehead.counterclockwise.rotate.90",command: .clearOlderDownloads) {@@ -235,7 +249,7 @@ struct HomebrewList: View {}row(title: "Clear Every Download",- detail: "Removes every download Homebrew keeps, even for the latest versions, as well as what Clean Up removes. The downloads of what is installed now stay.",+ detail: Text("Removes every download Homebrew keeps, even for the latest versions, as well as what Clean Up removes. The downloads of what is installed now stay."),systemImage: "tray.full",command: .clearEveryDownload) {@@ -243,7 +257,7 @@ struct HomebrewList: View {}row(title: "Repair Taps",- detail: "Adds the links missing from your taps’ manual pages and shell completions, and follows a tap whose main branch was renamed. It deletes nothing.",+ detail: Text("Adds the links missing from your taps’ manual pages and shell completions, and follows a tap whose main branch was renamed. It deletes nothing."),systemImage: "wrench.adjustable",command: .repairTaps) {@@ -251,7 +265,7 @@ struct HomebrewList: View {}row(title: "Check Health",- detail: "Asks Homebrew to check itself and report anything out of place, such as a broken link. It only looks and changes nothing. It can’t see the PATH your Terminal uses, so problems there don’t show up here.",+ detail: Text("Asks Homebrew to check itself and report anything out of place, such as a broken link. It only looks and changes nothing. It can’t see the PATH your Terminal uses, so problems there don’t show up here."),systemImage: "stethoscope",command: .health) {@@ -259,7 +273,7 @@ struct HomebrewList: View {}row(title: "Scan for Vulnerabilities",- detail: "Checks the installed formulae against the OSV.dev list of known vulnerabilities. Homebrew sends the source and version of each one to api.osv.dev, and only when you click Scan. Casks aren’t covered.",+ detail: Text("Checks the installed formulae against the OSV.dev list of known vulnerabilities. Homebrew sends the source and version of each one to api.osv.dev, and only when you click Scan. Casks aren’t covered."),systemImage: "shield",command: .vulnerabilities) {@@ -541,14 +555,14 @@ struct HomebrewList: View {private func row(title: LocalizedStringResource,- detail: LocalizedStringResource,+ detail: Text,systemImage: String,command: HomebrewLibrary.Command,@ViewBuilder trailing: () -> some View) -> some View {HStack(spacing: 6) {Label { Text(title) } icon: { Image(systemName: systemImage) }- InfoNote(name: String(localized: title), detail: Text(detail))+ InfoNote(name: String(localized: title), detail: detail)Spacer(minLength: 8)BusyShown(isBusy: homebrew.runningCommand == command) { isShown inif isShown {diff --git a/Peel/Views/RemovalFailureAlert.swift b/Peel/Views/RemovalFailureAlert.swiftindex 349b96cb..43f7531c 100644--- a/Peel/Views/RemovalFailureAlert.swift+++ b/Peel/Views/RemovalFailureAlert.swift@@ -38,6 +38,11 @@ struct RemovalFailureAlert: ViewModifier {listed(paths) { String(inflecting: "^[\($0) more folder](inflect: true)") }}+ /// Homebrew formulae named in one sentence, the same way.+ static func listedFormulae(_ names: [String]) -> String {+ listed(names) { String(inflecting: "^[\($0) more formula](inflect: true)") }+ }+/// Folders and files named in one sentence, the same way.static func listedItems(_ paths: [String]) -> String {listed(paths) { String(inflecting: "^[\($0) more item](inflect: true)") }diff --git a/PeelTests/UnreadableFoldersTests.swift b/PeelTests/UnreadableFoldersTests.swiftindex b93aa81a..e0a45026 100644--- a/PeelTests/UnreadableFoldersTests.swift+++ b/PeelTests/UnreadableFoldersTests.swift@@ -19,3 +19,14 @@ struct UnreadableFoldersTests {#expect(RemovalFailureAlert.first([1, 2]) == ([1, 2], 0))}}++struct CleanUpWarningTests {+ @Test func namesTheFirstFourFormulaeItUninstalls() {+ let formulae = (1...30).map { "formula\($0)x" }++ let sentence = HomebrewList.uninstalls(formulae)++ #expect(sentence.contains("formula4x") && !sentence.contains("formula5x") && !sentence.contains("formula30x"))+ #expect(sentence.contains("26"))+ }+}