From 79d673edbc177ce3550d906bb921cb78189a60c8 Mon Sep 17 00:00:00 2001 From: Spaxly <68564017+Spaxly@users.noreply.github.com> Date: Thu, 2 Dec 2021 09:17:23 +0000 Subject: feat: add some messages in uninstall.sh (#1945) Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- utils/installer/uninstall.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'utils/installer') diff --git a/utils/installer/uninstall.sh b/utils/installer/uninstall.sh index 31007984..236d657f 100755 --- a/utils/installer/uninstall.sh +++ b/utils/installer/uninstall.sh @@ -13,8 +13,6 @@ declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" # TODO: Use a dedicated cache directory #1256 declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" -LVIM_BIN="$(which lvim 2>/dev/null)" - declare -a __lvim_dirs=( "$LUNARVIM_CONFIG_DIR" "$LUNARVIM_RUNTIME_DIR" @@ -44,15 +42,33 @@ function parse_arguments() { done } -function main() { - parse_arguments "$@" +function remove_lvim_dirs() { for dir in "${__lvim_dirs[@]}"; do rm -rf "$dir" if [ "$ARGS_REMOVE_BACKUPS" -eq 1 ]; then rm -rf "$dir.bak" fi done - rm -f "$LVIM_BIN" +} + +function remove_lvim_bin() { + local legacy_bin="/usr/local/bin/lvim " + if [ -x "$legacy_bin" ]; then + echo "Error! Unable to remove $legacy_bin without elevation. Please remove manually." + exit 1 + fi + + lvim_bin="$(command -v lvim 2>/dev/null)" + rm -f "$lvim_bin" +} + +function main() { + parse_arguments "$@" + echo "Removing LunarVim binary..." + remove_lvim_bin + echo "Removing LunarVim directories..." + remove_lvim_dirs + echo "Uninstalled LunarVim!" } main "$@" -- cgit v1.2.3