Last active
August 6, 2022 19:53
-
-
Save dlvhdr/c4edfbcab07276ee2c8de064d157a1db to your computer and use it in GitHub Desktop.
Interactively uninstall brew packages with gum (https://github.com/charmbracelet/gum)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export HOMEBREW_NO_AUTO_UPDATE=1 | |
options=$(\ | |
brew bundle dump --describe --file - | \ | |
grep -E "^(brew|cask|#)" | \ | |
sed -E 's/^(brew|cask) \"(.*)\"(,.*)?/\2/' | \ | |
sed "s/#//" | \ | |
while read -r first; | |
do | |
if [[ $first != "#*" ]]; then | |
read -r second | |
echo "$second ($first)"; | |
else | |
echo "$first" | |
fi | |
done \ | |
) | |
echo "$options" | gum choose --no-limit | sed -E "s/(.* )\(.*\)/\1/" | xargs brew uninstall | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment