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
Read whose Homebrew it is before asking for its definitions
Țugui Dragoș54ff520fe754
diff --git a/Peel/Model/HomebrewLibrary.swift b/Peel/Model/HomebrewLibrary.swiftindex ae4aae5d..ce65d2c6 100644--- a/Peel/Model/HomebrewLibrary.swift+++ b/Peel/Model/HomebrewLibrary.swift@@ -413,11 +413,16 @@ final class HomebrewLibrary {HomebrewInstallation?, Result<[HomebrewPackage], Homebrew.CommandFailure>, Homebrew.CleanupPreview?,Homebrew.Overrides?)? {+ // The installation is read first: whose Homebrew this is needs no definitions, and it says how to read the+ // figures that follow.+ let found = await Homebrew.installation(asking: answers)+ if let found {+ installation = found+ }guard await Homebrew.hasLocalDefinitions(asking: answers) else { return nil }needsDefinitions = false- // The installation is read first, since it says how to read the figures that follow. The other questions- // take about as long as each other, so they run at the same time. Only the page shows the cleanup's figure.- let found = await Homebrew.installation(asking: answers)+ // The other questions take about as long as each other, so they run at the same time. Only the page shows the+ // cleanup's figure.let kept = found.flatMap { ExclusionsStore.shared.exclusions.keptFormulae(inCellar: $0.cellar) } ?? []async let preview = includingReclaimable ? Homebrew.cleanupPreview(asWrittenBy: found, keeping: kept) : nillet installed: Result<[HomebrewPackage], Homebrew.CommandFailure>diff --git a/PeelTests/HomebrewLibraryTests.swift b/PeelTests/HomebrewLibraryTests.swiftindex e63de189..0cf125b1 100644--- a/PeelTests/HomebrewLibraryTests.swift+++ b/PeelTests/HomebrewLibraryTests.swift@@ -66,6 +66,23 @@ private struct StandInBrew {}}+ @Test func saysWhoseHomebrewItIsWhileItsDefinitionsAreMissing() async throws {+ let brew = try StandInBrew(hasDefinitions: false)+ let path = brew.folder.path(percentEncoded: false)+ defer {+ _ = chmod(path, 0o755)+ brew.goAway()+ }+ #expect(chmod(path, 0o555) == 0)+ let homebrew = HomebrewLibrary()++ await Homebrew.$standIn.withValue(brew.url) { await homebrew.refresh() }++ #expect(homebrew.needsDefinitions)+ #expect(homebrew.installation?.version == "7.0.0")+ #expect(!homebrew.mayChange)+ }+@Test func oneBrewsFigureDoesNotOutliveTheChoiceOfAnother() async throws {let first = try StandInBrew(cleanup: "echo '==> This operation would free approximately 2GB of disk space.'")let second = try StandInBrew(cleanup: "exit 1")