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
Say Quit X first once in peel caches --remove
Țugui Dragoș13b4b336dc3a
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swiftindex f8e14e2c..0adb3a92 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift@@ -483,12 +483,13 @@ struct CachesCommand: AsyncParsableCommand {// from holds nothing up, whether its app runs or not.let moving = environments.filter { $0.locations.contains(where: \.isRecommended) }let open = moving.filter { $0.runningApp != nil }- for environment in open {- Output.note(Self.quitFirst(environment))- }let closed = environments.filter { environment in !open.contains { $0.id == environment.id } }let closedMoving = moving.filter { environment in !open.contains { $0.id == environment.id } }let locations = closedMoving.flatMap { environment in environment.locations.filter(\.isRecommended) }+ // With nothing else to move, the first of them is the error below.+ for environment in open.dropFirst(locations.isEmpty ? 1 : 0) {+ Output.note(Self.quitFirst(environment))+ }Self.notes(for: environments).forEach(Output.note)// Nobody asked for a folder Peel doesn't suggest on its own, so it is said here and never recorded as refused.let staying = Self.staying(in: closed)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swiftindex 978de9e2..9d72ffc1 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift@@ -143,10 +143,15 @@ struct FileCommandTests {#expect(collected.notes.contains("Quit Finder first"))#expect(FileManager.default.fileExists(atPath: directory.url.appending(path: "home/Library/Caches/finder-tool").path(percentEncoded: false)))+ let alone = Output.Collected()await #expect(throws: CommandFailure.self) {- try await (command(["caches", "--remove", "-y"]) as CachesCommand)- .clean([open], using: try service(in: directory), recordingIn: logs.removals, refusals: logs.refusals)+ try await Output.$collected.withValue(alone) {+ try await (command(["caches", "--remove", "-y"]) as CachesCommand).clean(+ [open], using: try service(in: directory), recordingIn: logs.removals, refusals: logs.refusals+ )+ }}+ #expect(!alone.notes.contains("Quit Finder first"), "the error says it, once")}@Test func aDryRunOnCachesMovesNothing() async throws {