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

This commit is contained in:
Vaisakh K M 2022-11-22 09:56:20 +05:30 committed by GitHub
parent 6132a30dff
commit 40ec8a0e6a
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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