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
Find an installer by what its row shows, such as the app an update is for
Țugui Dragoș440d8c15b100
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swiftindex 124f4f6b..05b2ec0f 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift@@ -57,6 +57,21 @@ public struct InstallerItem: Sendable, Hashable, Identifiable {}}+extension InstallerItem {+ /// Whether `query` matches what the row shows: the name, the app it is for, and its notes, such as the app that+ /// downloaded an update, whose own name is the updater's.+ public func matches(_ query: String) -> Bool {+ guard !query.isEmpty else { return true }+ let shown = [name, installedApp].compactMap(\.self) + notes.compactMap { note -> String? in+ switch note {+ case .version(let text), .name(let text), .downloadedBy(let text): text+ case .encrypted: nil+ }+ }+ return shown.contains { SearchText.matches($0, query) }+ }+}+extension Collection where Element == InstallerItem {public var movable: SizeTotal {SizeTotal(filter(\.canBeMoved).map(\.size))diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swiftindex 68fb03ad..d1e5f3b1 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift@@ -6,6 +6,25 @@ import Testingstruct InstallersTests {/// The macOS installers and the firmware are scanned after the downloads, and those later steps must stop/// as well.+ @Test func aSearchFindsAnItemByWhatItsRowShows() {+ func item(+ _ name: String, kind: InstallerItem.Kind, for app: String? = nil, notes: [InstallerItem.Note] = []+ ) -> InstallerItem {+ InstallerItem(+ url: URL(filePath: "/Users/x/Downloads/\(name)"), kind: kind, name: name, size: 1, date: nil,+ installedApp: app, isReadOnly: false, notes: notes+ )+ }+ let update = item("org.sparkle-project.Sparkle", kind: .updateDownload, notes: [.downloadedBy("Firefox")])+ let installer = item("Setup.dmg", kind: .appInstaller, for: "Slack")+ let backup = item("00008030-001", kind: .deviceBackup, notes: [.name("Ana’s iPhone"), .encrypted])++ #expect(update.matches("firefox"))+ #expect(installer.matches("slack") && installer.matches("setup"))+ #expect(backup.matches("ana’s"))+ #expect(!update.matches("slack") && !installer.matches("firefox"))+ }+@Test func aStoppedScanStops() async throws {let directory = try TemporaryDirectory()for index in 1...30 {diff --git a/Peel/Views/Installers/InstallerList.swift b/Peel/Views/Installers/InstallerList.swiftindex 377312bb..ade98968 100644--- a/Peel/Views/Installers/InstallerList.swift+++ b/Peel/Views/Installers/InstallerList.swift@@ -8,12 +8,12 @@ struct InstallerList: View {@State private var isRescanning = false@State private var searchText = ""- /// The kinds to list. During a search, a kind is kept when its title or the name of any item in it matches.+ /// The kinds to list. During a search, a kind is kept when its title or any of its items matches.private var listed: [InstallerItem.Kind] {guard !searchText.isEmpty else { return installers.sections }return installers.sections.filter { kind inSearchText.matches(String(localized: kind.title), searchText)- || installers.items(in: kind).contains { SearchText.matches($0.name, searchText) }+ || installers.items(in: kind).contains { $0.matches(searchText) }}}