-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotfiles.sh
executable file
·56 lines (49 loc) · 1.07 KB
/
dotfiles.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
#!/bin/bash
############################
# Dotfiles! Thank the wizard
############################
name="Dotfiles 0.0.2"
# Show the usage screen.
function print_help {
# Add an indent level to messages.
function indent {
local indention=""
for _ in `seq 1 "$1"`; do
indention=`echo "$indention "`
done
echo "$indention$2"
}
echo $name
echo "Usage: dotfiles <command>"
indent 1 "link - Symlink project dotfiles to home directory"
indent 1 "update - Pull new dotfiles from git repo"
indent 1 "install - Install programs"
indent 1 "dir - Print the dotfiles directory"
}
function install {
bash "$DOTFILES_DIR/install.sh"
}
# Figure out what command to run.
case "$1" in
"link")
link_everything
;;
"update")
update
;;
"install")
install
;;
"dir")
echo "$DOTFILES_DIR"
;;
*)
if [[ ! -z "$1" && "$1" != "--help" ]]; then
echo "Invalid command '$@'. Showing help instead."
print_help
# Probably a typo. Make them feel the pain!
exit 1
fi
print_help
;;
esac