Explorar o código

fix(uninstaller): add separate flag to remove user config (#3508)

Vaisakh K M %!s(int64=2) %!d(string=hai) anos
pai
achega
40ec8a0e6a
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  1. 10 1
      utils/installer/uninstall.sh

+ 10 - 1
utils/installer/uninstall.sh

@@ -2,6 +2,7 @@
 set -eo pipefail
 
 ARGS_REMOVE_BACKUPS=0
+ARGS_REMOVE_CONFIG=0
 
 declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}"
 declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}"
@@ -12,16 +13,18 @@ declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
 declare -r LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}"
 
 declare -a __lvim_dirs=(
-  "$LUNARVIM_CONFIG_DIR"
   "$LUNARVIM_RUNTIME_DIR"
   "$LUNARVIM_CACHE_DIR"
 )
 
+__lvim_config_dir="$LUNARVIM_CONFIG_DIR"
+
 function usage() {
   echo "Usage: uninstall.sh [<options>]"
   echo ""
   echo "Options:"
   echo "    -h, --help                       Print this help message"
+  echo "    --remove-config                  Remove old backup folders as well"
   echo "    --remove-backups                 Remove old backup folders as well"
 }
 
@@ -31,6 +34,9 @@ function parse_arguments() {
       --remove-backups)
         ARGS_REMOVE_BACKUPS=1
         ;;
+      --remove-config)
+        ARGS_REMOVE_CONFIG=1
+        ;;
       -h | --help)
         usage
         exit 0
@@ -41,6 +47,9 @@ function parse_arguments() {
 }
 
 function remove_lvim_dirs() {
+  if [ "$ARGS_REMOVE_CONFIG" -eq 1 ]; then
+    __lvim_dirs+=($__lvim_config_dir)
+  fi
   for dir in "${__lvim_dirs[@]}"; do
     rm -rf "$dir"
     if [ "$ARGS_REMOVE_BACKUPS" -eq 1 ]; then