Skip to content

Instantly share code, notes, and snippets.

@spookyuser
Created July 27, 2023 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spookyuser/c3cf304d8330123232bb58057b9f8883 to your computer and use it in GitHub Desktop.
Save spookyuser/c3cf304d8330123232bb58057b9f8883 to your computer and use it in GitHub Desktop.
Brew uninstall !! for fish !! yay !!
function brew
if test (count $argv) -gt 0
if test $argv[1] = "install"
/opt/homebrew/bin/brew $argv
if test $status -eq 0
echo $argv[2..-1] > /tmp/.brew_last_installed
end
return
else if test $argv[1] = "uninstall" -a $argv[2] = "!!"
if test -f /tmp/.brew_last_installed
set last_package (cat /tmp/.brew_last_installed)
/opt/homebrew/bin/brew uninstall $last_package
if test $status -eq 0
echo "Package" $last_package "has been uninstalled."
rm /tmp/.brew_last_installed
end
else
echo "No record of the last installed package."
end
return
end
end
/opt/homebrew/bin/brew $argv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment