The Meowgorithm Dotfiles, Collectors’ Edition
#!/usr/bin/env bash
set -euo pipefail
brewLocation="charmbracelet/tap/crush"
npmLocation="@charmland/crush"
local_bin="${HOME}/.bin/crush"
go_crush="${GOBIN:-${GOPATH:-$HOME/go}/bin}/crush"
found=0
if command -v brew >/dev/null 2>&1 && brew list "$brewLocation" >/dev/null 2>&1; then
echo "Found Crush via Homebrew"
found=1
fi
if command -v npm >/dev/null 2>&1 && npm list -g "$npmLocation" >/dev/null 2>&1; then
echo "Found Crush via NPM"
found=1
fi
if [[ -x "$local_bin" ]]; then
echo "Found local Crush binary at $local_bin"
found=1
fi
if [[ -x "$go_crush" ]]; then
echo "Found Crush Go binary at $go_crush"
found=1
fi
if [[ $found -eq 0 ]]; then
echo "Crush is not installed"
exit 1
fi
if command -v brew >/dev/null 2>&1 && brew list "$brewLocation" >/dev/null 2>&1; then
echo "Uninstalling via Homebrew..."
brew uninstall "$brewLocation"
fi