mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 10:35:08 +02:00
fix(uninstaller): add separate flag to remove user config (#3508)
This commit is contained in:
parent
6132a30dff
commit
40ec8a0e6a
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue