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
Don't say peel search may list what it leaves out
Țugui Dragoș8e21f2d6c0ac
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swiftindex bf30747c..38d0dee3 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift@@ -948,7 +948,7 @@ struct SearchCommand: AsyncParsableCommand {}func run() async throws {- let results = await FileSearch.run(criteria, exclusions: UnreadableExclusions.load())+ let results = await FileSearch.run(criteria, exclusions: UnreadableExclusions.load(listsEverything: false))guard results.didRun else {throw CommandFailure("Spotlight didn't answer, so Peel can't say what is on this Mac. Try the search again.")}diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/UnreadableExclusions.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/UnreadableExclusions.swiftindex 9211aa84..b20a2258 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/UnreadableExclusions.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/UnreadableExclusions.swift@@ -2,16 +2,22 @@ import Foundationimport PeelCore/// Loads the exclusions for a scan, with a warning when they can't be read. The scan still runs, since the guard-/// moves nothing meanwhile, but it may list items the user excluded.+/// moves nothing meanwhile: a listing may then show items the user excluded, while a search leaves out everything it+/// can't check against them (`listsEverything` false) and says so in its own note.enum UnreadableExclusions {- static func note(for exclusions: Exclusions, savedAt url: URL = ExclusionStore.defaultURL) -> String? {+ static func note(+ for exclusions: Exclusions, savedAt url: URL = ExclusionStore.defaultURL, listsEverything: Bool = true+ ) -> String? {guard exclusions.isUnreadable else { return nil }- return "Peel couldn't read your exclusions at \(Output.plain(url.path(percentEncoded: false))), so this may list what you asked it to leave alone, and nothing will be moved. Open Peel and click Start Over in Settings > Exclusions."+ let place = Output.plain(url.path(percentEncoded: false))+ return listsEverything+ ? "Peel couldn't read your exclusions at \(place), so this may list what you asked it to leave alone, and nothing will be moved. Open Peel and click Start Over in Settings > Exclusions."+ : "Peel couldn't read your exclusions at \(place). Open Peel and click Start Over in Settings > Exclusions."}- static func load(from store: ExclusionStore = ExclusionStore()) async -> Exclusions {+ static func load(from store: ExclusionStore = ExclusionStore(), listsEverything: Bool = true) async -> Exclusions {let exclusions = await store.load()- if let note = note(for: exclusions, savedAt: store.url) {+ if let note = note(for: exclusions, savedAt: store.url, listsEverything: listsEverything) {Output.note(note)}return exclusionsdiff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swiftindex a10085cb..b4c5de4a 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift@@ -261,6 +261,14 @@ struct CommandLineTests {#expect(note.contains("/tmp/exclusions.json"))}+ @Test func aSearchDoesNotSayItListsWhatItLeavesOut() throws {+ let saved = URL(filePath: "/tmp/exclusions.json")+ let note = try #require(UnreadableExclusions.note(for: .unreadable, savedAt: saved, listsEverything: false))+ #expect(note.contains("/tmp/exclusions.json"))+ #expect(note.contains("Start Over"))+ #expect(!note.contains("may list"))+ }+@Test func findsAppsByTheirBundleName() throws {let notes = InstalledApp(url: URL(filePath: "/Applications/Notes Pro.app", directoryHint: .isDirectory), bundleIdentifier: "com.example.NotesPro", name: "Notes Pro")let code = InstalledApp(url: URL(filePath: "/Applications/Visual Studio Code.app", directoryHint: .isDirectory), bundleIdentifier: "com.example.code", name: "Code")