Correctly cleanup zellij on MacOS

This commit is contained in:
Lockszmith (@VAST) 2025-04-10 11:16:26 -04:00
parent 93755bfc0a
commit 491bc65261
1 changed files with 7 additions and 4 deletions

View File

@ -15,14 +15,17 @@ BASE_SHELL="${BASE_SHELL:-$(basename "$SHELL")}"
if is_sourced; then if is_sourced; then
zellij-cleanup() { zellij-cleanup() {
env which zellij > /dev/null && env which zellij | grep -E "^$HOME" | ${SUDO:-} xargs -tr rm env which zellij > /dev/null && command -v zellij | grep -E "^$HOME" | ${SUDO:-} xargs -tr rm
[[ -d "$HOME/.cache/zellij" ]] && echo "$HOME/.cache/zellij" | ${SUDO:-} xargs -tr rm -fR [[ -d "$HOME/.cache/zellij" ]] \
&& ${SUDO:-} rm -fR "$HOME/.cache/zellij"
[[ -d "$HOME/Library/Caches/org.Zellij-Contributors.Zellij" ]] \
&& ${SUDO:-} rm -fR "$HOME/Library/Caches/org.Zellij-Contributors.Zellij"
find /tmp -maxdepth 1 -mindepth 1 -type d -name 'zellij*' -print0 | ${SUDO:-} xargs -r0t rm -fR find /tmp -maxdepth 1 -mindepth 1 -type d -name 'zellij*' -print0 | ${SUDO:-} xargs -r0t rm -fR
if [[ -d "$HOME/.cache/zellij" ]]; then if [[ -d "$HOME/.cache/zellij" || -d "$HOME/Library/Caches/org.Zellij-Contributors.Zellij" ]]; then
printf 'Zellij cleanup failed to remove the cache directory, you might still have a zellij session active.\n' printf 'Zellij cleanup failed to remove the cache directory, you might still have a zellij session active.\n'
else else
printf 'Zellij has been cleaned up, you can now reinstall it.\n' printf 'Zellij has been cleaned up, you can now reinstall it.\n'
unset zellij-cleanup unset -f zellij-cleanup
fi fi
} }
refresh-zellij() { refresh-zellij() {