add script to clean nvim stuff
This commit is contained in:
41
clean.sh
Executable file
41
clean.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
TAG=.bak-$(date +%Y%m%d)
|
||||
|
||||
SRC_DIRS=(
|
||||
"$HOME/.local/share/nvim"
|
||||
"$HOME/.local/state/nvim"
|
||||
"$HOME/.cache/nvim"
|
||||
)
|
||||
|
||||
# Show plan and confirm
|
||||
printf "This will back up and clean your Neovim directories.\n"
|
||||
printf "Backup suffix to be appended: %s\n\n" "$TAG"
|
||||
|
||||
printf "Planned moves (only if source exists):\n"
|
||||
for SRC in "${SRC_DIRS[@]}"; do
|
||||
DEST="${SRC}${TAG}"
|
||||
printf " %s -> %s\n" "$SRC" "$DEST"
|
||||
done
|
||||
|
||||
printf "\n"
|
||||
read -r -p "Are you sure you want to proceed? [y/N]: " CONFIRM
|
||||
case ${CONFIRM:-} in
|
||||
[yY]|[yY][eE][sS]) ;;
|
||||
*) printf "Aborted!\n"; exit 0;;
|
||||
esac
|
||||
|
||||
# Perform moves, skipping missing sources
|
||||
for SRC in "${SRC_DIRS[@]}"; do
|
||||
if [ -e "$SRC" ]; then
|
||||
DEST="${SRC}${TAG}"
|
||||
printf "Moving %s -> %s\n" "$SRC" "$DEST"
|
||||
mv "$SRC" "$DEST"
|
||||
else
|
||||
printf "Skipping missing: %s\n" "$SRC"
|
||||
fi
|
||||
done
|
||||
|
||||
printf "Done!"
|
||||
Reference in New Issue
Block a user