mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
fix: preserve user .zshrc when no backup exists during uninstall
- When uninstalling, if no original backup (.zshrc.pre-oh-my-zsh) exists, restore the current .zshrc with Oh My Zsh lines removed - Prevents data loss for users who installed years ago on different machines - Keeps the timestamped backup file for safety Fixes #13156 Fixes #13328
This commit is contained in:
parent
1e3abc123f
commit
32275bd605
1 changed files with 6 additions and 0 deletions
|
|
@ -35,6 +35,12 @@ if [ -e "$ZSHRC_ORIG" ]; then
|
||||||
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"
|
||||||
|
if [ -e "${ZSHRC_SAVE}" ]; then
|
||||||
|
echo "Restoring your current config and removing Oh My Zsh lines..."
|
||||||
|
grep -v 'source.*oh-my-zsh\.sh' "${ZSHRC_SAVE}" > ~/.zshrc
|
||||||
|
echo "Your config was restored with Oh My Zsh lines removed."
|
||||||
|
echo "Original file saved at: ${ZSHRC_SAVE}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
|
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue