#!/bin/bash set -euo pipefail DEBUG=false ROOT_SRC=".." TARGET_NAME="convert-dirs" PREFIX="${PREFIX:-/usr/local}" INSTALL_PATH="$PREFIX/bin/$TARGET_NAME" while [[ $# -gt 0 ]]; do case "$1" in --debug) DEBUG=true shift ;; --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 if [[ "$DEBUG" == true ]]; then echo "ROOT_SRC=$ROOT_SRC" echo "TARGET_NAME=$TARGET_NAME" echo "PREFIX=$PREFIX" echo "INSTALL_PATH=$INSTALL_PATH" fi # 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."