-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake.sh
executable file
·99 lines (84 loc) · 2.07 KB
/
make.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
set -e
ver_number="0.2"
function applyit () {
# check any config file exists
if [[ -f "$HOME/.zshrc" ]]; then
# check any backup file exists
if [[ -f "$HOME/.zshrc.bak" ]]; then
echo "remove old backup.."
rm -f $HOME/.zshrc.bak
fi
# backup the current .zshrc file if exists
echo "backup ${HOME}/zshrc file.."
mv -f $HOME/.zshrc $HOME/.zshrc.bak
echo ""
fi
# check any zsh.d directory exists
if [[ -d "$HOME/.zsh.d" ]]; then
# check any backup zsh.d directory exists
if [[ -d "$HOME/.zsh.d.bak" ]]; then
echo "remove old backup.."
rm -rf $HOME/.zsh.d.bak
fi
# backup the current .zsh.d directory if exists
echo "backup ${HOME}/zsh.d directory.."
cp -rf $HOME/.zsh.d $HOME/.zsh.d.bak
rm -rf $HOME/.zsh.d
echo ""
fi
# copy the new config file to home folder
echo "copy new config files.."
cp -f zshrc $HOME/.zshrc
# copy the new config file to home folder
mkdir $HOME/.zsh.d
cp -f zsh/* $HOME/.zsh.d/
echo "config files added"
# print exit status
echo "[ Shell returned $? ]"
exit 0
}
function help () {
cat << _EOF
powermore-zsh plugin, a fork of powerless plugin.
I just added some more git functionalities to it.
for more details checkout the base project.
Version ${ver_number}
Usage: [ ./make.sh ] or [ bash make.sh ]
Running this script without any arguments will backup
the current ~/.zshrc and ~/.zsh.d (if there is any already)
and copy the new config files into your \$HOME directory.
Arguments:
-h print this message
-v print version and exit
-r removes the backup files
for having a cleaner home folder ;)
Wanna fork it?
https://github.com/primejade/powermore-zsh
The powerless project:
https://github.com/martinrotter/powerless
_EOF
exit 0
}
function backup_remove () {
if [[ -d "$HOME/.zsh.d.bak" ]]; then
echo "remove backups.."
rm -rf $HOME/.zsh.d.bak
rm -rf $HOME/.zsh.d.bak
else
echo "You are clean, no backup file exists :)"
fi
exit 0
}
case $1 in
"") applyit
;;
-h) help
;;
-r) backup_remove
;;
-v) echo "powermore ZSH plugin version ${ver_number}"
;;
*) help
;;
esac