-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall_theme.sh
More file actions
executable file
·38 lines (31 loc) · 1.26 KB
/
uninstall_theme.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
THEME_NAME="gettowork"
DEFAULT_THEME="robbyrussell"
ZSH_THEME_DIR="$HOME/.oh-my-zsh/themes"
ZSHRC_FILE="$HOME/.zshrc"
ORIGINAL_ZSHRC="$HOME/.zshrc.original"
uninstall_theme() {
echo "Uninstalling theme..."
if [ -f "$ZSH_THEME_DIR/$THEME_NAME.zsh-theme" ]; then
rm "$ZSH_THEME_DIR/$THEME_NAME.zsh-theme" || { echo "Error: Unable to remove theme file from $ZSH_THEME_DIR."; exit 1; }
echo "Theme file removed successfully."
else
echo "Warning: Theme file '$THEME_NAME.zsh-theme' not found in $ZSH_THEME_DIR."
fi
if [ -f "$ORIGINAL_ZSHRC" ]; then
mv "$ORIGINAL_ZSHRC" "$ZSHRC_FILE" || { echo "Error: Unable to restore original .zshrc file."; exit 1; }
echo "Original .zshrc file restored successfully."
else
echo "Warning: Original .zshrc file not found. It may not have been modified."
fi
sed -i "s/ZSH_THEME=\"$THEME_NAME\"/ZSH_THEME=\"$DEFAULT_THEME\"/" "$ZSHRC_FILE" || { echo "Error: Unable to set theme in $ZSHRC_FILE."; exit 1; }
echo "ZSH_THEME set to default theme '$DEFAULT_THEME'."
echo "Theme uninstalled successfully!"
echo "Restart your Terminal!"
}
if [ -f "$ZSH_THEME_DIR/$THEME_NAME.zsh-theme" ] || [ -f "$ORIGINAL_ZSHRC" ]; then
uninstall_theme
else
echo "Error: The theme '$THEME_NAME' doesn't seem to be installed."
exit 1
fi