-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
47 lines (39 loc) · 1.27 KB
/
install.sh
File metadata and controls
47 lines (39 loc) · 1.27 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
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# I took this install script from another nice zsh theme: https://github.com/denysdovhan/spaceship-zsh-theme
# I just change it a litte bit.
# load oh-my-zsh variables
source "$HOME/.zshrc"
# script values
REMOTE='https://raw.githubusercontent.com/sfabrizio/ozono-zsh-theme/master/ozono-theme.zsh'
THEME_DIR="$ZSH_CUSTOM/themes/ozono.zsh-theme"
THEME_NAME='ozono'
# 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
}
# 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_DIR $REMOTE || { error "Filed!" ; return }
elif $(command -v wget >/dev/null 2>&1); then
# Using wget
wget -O $THEME_DIR $REMOTE || { error "Filed!" ; return }
else
# Exit with error
error "curl and wget are unavailable!"
exit 1
fi
# Replace current theme with the right onw
sed -i "s/ZSH_THEME='.*'/ZSH_THEME='$THEME_NAME'/g" "$HOME/.zshrc" \
|| error "Cannot change theme in ~/.zshrc. Please, do it by yourself." \
&& message "Done! $THEME_NAME is intalled. Please, reload your terminal."