convert-dirs/bin/uninstall.sh

37 lines
687 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
ROOT_SRC=".."
TARGET_NAME="convert-dirs"
PREFIX="${PREFIX:-/usr/local}"
INSTALL_PATH="$PREFIX/bin/$TARGET_NAME"
while [[ $# -gt 0 ]]; do
case "$1" in
--prefix)
PREFIX="$2"
INSTALL_PATH="$PREFIX/bin/$TARGET_NAME"
shift 2
;;
--help|-h)
echo "Usage: $0 [--prefix /custom/bin/path]" >&2
exit 0
;;
*)
echo "Unknown option $1" >&2
exit 1
;;
esac
done
# check and remove
if [[ ! -f "$INSTALL_PATH" ]]; then
echo "$INSTALL_PATH not found. Nothing to uninstall."
exit 1
fi
echo "🗑️ Removing $INSTALL_PATH ..."
sudo rm "$INSTALL_PATH"
echo "✅ Uninstalled successfully."