-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·57 lines (45 loc) · 1.04 KB
/
configure.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
#!/bin/bash
programs="${@}"
check_program() {
local dir
local program
program="${1}"
dir="$HOME/dotfiles/${program}/"
printf "\\nChecking for ${program}... "
if [ ! -d $dir ]; then
printf "\\nI do not have config for ${program} :(\\n"
exit 1
fi
which "${program}"
if [[ "${?}" -ne 0 ]]; then
printf "\\n${program} is not installed. Please install it before apply my config.\\n"
else
apply_config "${program}"
fi
}
apply_config() {
local program
program="${1}"
printf "Creating config for ${program}...\\n"
cp ~/dotfiles/${program}/.${program} ~/.${program}
printf "Done.\\n"
}
usage() {
printf "|-------------------------|\\n"
printf "| Pablo's dotfiles script |\\n"
printf "|-------------------------|\\n"
printf "\\nUsage:\\n"
printf " ${0} <programs>\\n"
printf "Examples:\\n"
printf " ${0} emacs zsh i3lock\\n"
}
main() {
if [[ -z "${programs}" ]]; then
usage
exit 1
fi
for p in ${programs}; do
check_program "${p}"
done
}
main