mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-22 04:51:12 +02:00
fix(uninstall): respect ZDOTDIR and ZSH environment variables
This commit is contained in:
parent
a07126330b
commit
1b8bb3615f
1 changed files with 15 additions and 10 deletions
|
|
@ -16,22 +16,27 @@ if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Removing ~/.oh-my-zsh"
|
# Use $ZSH if set, otherwise fall back to ~/.oh-my-zsh
|
||||||
if [ -d ~/.oh-my-zsh ]; then
|
: ${ZSH:=~/.oh-my-zsh}
|
||||||
rm -rf ~/.oh-my-zsh
|
# Use $ZDOTDIR if set, otherwise fall back to $HOME
|
||||||
|
: ${ZDOTDIR:=$HOME}
|
||||||
|
|
||||||
|
echo "Removing $ZSH"
|
||||||
|
if [ -d "$ZSH" ]; then
|
||||||
|
rm -rf "$ZSH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e ~/.zshrc ]; then
|
if [ -e "$ZDOTDIR/.zshrc" ]; then
|
||||||
ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)
|
ZSHRC_SAVE="$ZDOTDIR/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)"
|
||||||
echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}"
|
echo "Found $ZDOTDIR/.zshrc -- Renaming to ${ZSHRC_SAVE}"
|
||||||
mv ~/.zshrc "${ZSHRC_SAVE}"
|
mv "$ZDOTDIR/.zshrc" "${ZSHRC_SAVE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Looking for original zsh config..."
|
echo "Looking for original zsh config..."
|
||||||
ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh
|
ZSHRC_ORIG="$ZDOTDIR/.zshrc.pre-oh-my-zsh"
|
||||||
if [ -e "$ZSHRC_ORIG" ]; then
|
if [ -e "$ZSHRC_ORIG" ]; then
|
||||||
echo "Found $ZSHRC_ORIG -- Restoring to ~/.zshrc"
|
echo "Found $ZSHRC_ORIG -- Restoring to $ZDOTDIR/.zshrc"
|
||||||
mv "$ZSHRC_ORIG" ~/.zshrc
|
mv "$ZSHRC_ORIG" "$ZDOTDIR/.zshrc"
|
||||||
echo "Your original zsh config was restored."
|
echo "Your original zsh config was restored."
|
||||||
else
|
else
|
||||||
echo "No original zsh config found"
|
echo "No original zsh config found"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue