-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.sh
64 lines (52 loc) · 2.39 KB
/
misc.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env sh
source ./user-interactions.sh
## Install powerline font to decorate terminal
function install_powerline_font() {
alert "Installing powerline font...\n\n"
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts
success "Successfully installed powerline font\n\n"
}
function update_zshrc_with_theme() {
alert "Proceeding to update ${bold}.zshrc${normal} file...\n\n"
local ZSHRC_FILE_LOCATION="$HOME/.zshrc"
local ZSHRC_FILE_BACKUP_LOCATION="${ZSHRC_FILE_LOCATION}.backup"
local current_timestamp=$(date "+%Y%m%d-%H%M%S")
if [ -d "${ZSHRC_FILE_BACKUP_LOCATION}" ]; then
echo "${bold}${ZSHRC_FILE_BACKUP_LOCATION}${normal}\n\n"
ls -al "${ZSHRC_FILE_BACKUP_LOCATION}"
else
alert "\n${bold}${red}${ZSHRC_FILE_BACKUP_LOCATION} directory does not exists. Creating one.\n"
mkdir -p "${ZSHRC_FILE_BACKUP_LOCATION}"
fi
if [ -f "${ZSHRC_FILE_LOCATION}" ]; then
alert "\nCreating backup of existing .zshrc file to ${bold}${ZSHRC_FILE_BACKUP_LOCATION}/.zshrc.${current_timestamp}${normal}\n\n"
cp "${ZSHRC_FILE_LOCATION}" "${ZSHRC_FILE_BACKUP_LOCATION}/.zshrc.${current_timestamp}"
cp ./dotfiles/.zshrc "${ZSHRC_FILE_LOCATION}"
success "\nSuccessfully updated ${bold}${ZSHRC_FILE_LOCATION}${normal}\n\n"
fi
success "Successfully sourced ${bold}${ZSHRC_FILE_LOCATION}${normal}\n\n"
alert "\n\n To activate agnoster fonts please perform the followings.."
echo "
1. ${bold}Restart your terminal${normal}\n
2. Go To ${bold}Preferences > Profiles > Text > Change Font${normal} and set it to something that has ${bold}'for Powerline'${normal}\n
3. Save it and enjoy experience the updated theme\n
"
alert "\n\n To reflect the changes of ${ZSHRC_FILE_LOCATION}${normal}\n"
echo " Run: ${bold}source ${ZSHRC_FILE_LOCATION}${normal}\n"
}
## Reference: https://github.com/mbadolato/iTerm2-Color-Schemes
function update_color_scheme() {
alert "Importing additional color schemes...\n\n"
git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git color-schemes
# Import all color schemes
color-schemes/tools/import-scheme.sh color-schemes/schemes/*
rm -rf color-schemes
success "Color schemes imported successfully\n\n\n"
}
install_powerline_font
update_color_scheme
update_zshrc_with_theme