-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·45 lines (37 loc) · 1.09 KB
/
install.sh
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
39
40
41
42
43
44
45
#!/usr/bin/env zsh
# Source ~/.zshrc because we need oh-my-zsh variables
source "$HOME/.zshrc"
# Red bold error
function error() {
echo
echo "$fg_bold[red]Error: $* $reset_color"
echo
}
# Green bold message
function message() {
echo
echo "$fg_bold[green]Message: $* $reset_color"
echo
}
# Files
REMOTE='https://raw.githubusercontent.com/kimwz/kimwz-oh-my-zsh-theme/master/kimwz.zsh-theme'
THEME="$ZSH_CUSTOM/themes/kimwz.zsh-theme"
# If themes folder isn't exist, then make it
[ -d $ZSH_CUSTOM/themes ] || mkdir $ZSH_CUSTOM/themes
# Download theme from repo
if $(command -v curl >/dev/null 2>&1); then
# Using curl
curl -o $THEME $REMOTE || { error "Filed!" ; return }
elif $(command -v wget >/dev/null 2>&1); then
# Using wget
wget -O $THEME $REMOTE || { error "Filed!" ; return }
else
# Exit with error
error "curl and wget are unavailable!"
exit 1
fi
# Replace current theme to new theme.
sed -ie "s/ZSH_THEME=.*/ZSH_THEME='kimwz'/g" "$HOME/.zshrc" \
|| error "Cannot change theme in ~/.zshrc. Please, do it by yourself." \
&& message "Done! Please, reload your terminal."
exec zsh