Skip to content

Uninstall asks about the Brewfile entry; new casks follow the file's greedy style - #2

Merged
sevmorris merged 1 commit into
mainfrom
claude/uninstall-remove-greedy
Sep 27, 2026
Merged

sevmorris merged 1 commit into
mainfrom
claude/uninstall-remove-greedy

Conversation

@sevmorris

Copy link
Copy Markdown
Owner

Uninstall can remove the Brewfile entry too

In the Brewfile view, Uninstall… (for one package or a selection) now opens a dialog with three choices:

  • Uninstall and Remove from Brewfile
  • Uninstall, Keep in Brewfile
  • Cancel

Before, Uninstall always kept the entry, so removing a package from both the Mac and the Brewfile took two actions.

  • Only packages that brew actually uninstalled lose their entries. A failed or stopped uninstall leaves the Brewfile as it was.
  • The removal is one undoable edit.
  • The Installed view lists only packages that aren't in the Brewfile, so its bulk Uninstall doesn't ask.

New casks match the file's greedy: true style

add() writes cask "name", greedy: true when most of the Brewfile's casks already carry it, and a bare line otherwise. Barkeep follows the file rather than checking whether the Brewfile is mrk's. In mrk's Brewfile every cask carries it, and each cask Barkeep added was the odd one out, which had to be fixed by hand.

Code

  • BrewfileEntry.isGreedy; canonicalLine(name:kind:greedy:).
  • BrewfileViewModel.newCasksAreGreedy; remove(packages:brewfileURL:), which matches by name and kind.
  • uninstallEach now returns the packages it uninstalled. Its log and notification say "uninstalled" rather than "removed", which now means something else.
  • The help window and README describe both changes.
  • release-notes/v1.13.0.md is a draft. I assumed 1.13.0 because these are two new features; rename the file if the version you release is different.

Tests

36 pass locally with xcodebuild … test (30 existing, 6 new), with no new warnings. The new tests cover:

  • adding a cask to a greedy Brewfile, a bare one, and one with no casks;
  • a formula never getting greedy: true;
  • what isGreedy counts as greedy;
  • removal by name and kind when a formula and a cask share a name;
  • a removal that matches nothing leaving the file and the undo stack alone.

Not tested by hand: I didn't click through the dialog in the running app. That would have run real brew uninstall commands against your real Brewfile.

Related

Those two describe 1.13.0 by version number, so merge them once this ships.

🤖 Generated with Claude Code

…greedy style

Uninstall in the Brewfile view ran `brew uninstall` and kept the entry,
so taking a package off the Mac and out of the Brewfile took two
actions. For one package or a selection, it now asks: Uninstall and
Remove from Brewfile, or Uninstall, Keep in Brewfile. Only the packages
brew actually uninstalled lose their entries, so a failed or stopped
uninstall leaves the Brewfile as it was. The removal is one undoable
edit. The Installed view lists only packages not in the Brewfile, so its
bulk Uninstall is unchanged.

A cask Barkeep adds now gets `greedy: true` when most of the Brewfile's
casks carry it, and stays bare otherwise. Barkeep follows the file
rather than knowing about mrk. mrk's Brewfile puts it on every cask, and
before this each cask added here was the odd one out, to be fixed by
hand.

BrewfileViewModel gains remove(packages:), matching by name and kind,
and newCasksAreGreedy; BrewfileEntry gains isGreedy and a greedy
argument to canonicalLine. Six tests cover add with greedy and bare
Brewfiles and one with no casks, what isGreedy reads, and removal by
name and kind when a formula and a cask share a name. The help window
and README describe both. Draft notes are in release-notes/v1.13.0.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sevmorris
sevmorris merged commit 3446160 into main Sep 27, 2026
1 check passed
@sevmorris
sevmorris deleted the claude/uninstall-remove-greedy branch September 30, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant