Skip to content

Instantly share code, notes, and snippets.

@BaksiLi
Created August 11, 2023 15:28
Show Gist options
  • Save BaksiLi/498c63a1cd12e3dd1f6b7426206c33ed to your computer and use it in GitHub Desktop.
Save BaksiLi/498c63a1cd12e3dd1f6b7426206c33ed to your computer and use it in GitHub Desktop.
Remove Zinit folders
# ZINIT_HOME="/home/username/.local/share/zinit/zinit.git"
zinit_remove() {
local target_dir
case "$1" in
-s|--snippets)
target_dir="${ZINIT_HOME:s/zinit\.git/snippets}"
;;
-p|--plugins)
target_dir="${ZINIT_HOME:s/zinit\.git/plugins}"
;;
-a|--all)
zinit_remove -s
zinit_remove -p
return
;;
*)
echo "Invalid option. Select from -s, -p, or -a only."
return 1
esac
if [[ -d ${target_dir} ]]; then
echo "Are you sure you want to delete ${target_dir}? [y/n]"
read -k1 confirm
if [[ ${confirm} != "y" ]]; then
echo "Abort operation."
return 1
fi
echo "Deleting ${target_dir} ..."
rm -rf ${target_dir}
else
echo "${target_dir} does not exist."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment