-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot.sh
executable file
·64 lines (53 loc) · 1.39 KB
/
dot.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
#!/bin/sh
DOTFILES=$HOME/dotfiles
usage() {
cat <<- EOF
Usage: ./dot.sh <command>
Commands:
setup Sets up or updates files and symbolic links
backup Creates a backup
uninstall Removes files and symbolic links
EOF
}
setup() {
ln -fs $DOTFILES/config/zsh/.zshrc $HOME/.zshrc
ln -fs $DOTFILES/config/starship/starship.toml $HOME/.config/starship.toml
ln -fs $DOTFILES/config/vim/.vimrc $HOME/.vimrc
ln -fs $DOTFILES/config/idea/.ideavimrc $HOME/.ideavimrc
ln -Fhs $DOTFILES/bin $HOME/bin
ln -Fhs $DOTFILES/config/gh-dash $HOME/.config/gh-dash
ln -Fhs $DOTFILES/config/nvim $HOME/.config/nvim
ln -Fhs $DOTFILES/config/kitty $HOME/.config/kitty
ln -Fhs $DOTFILES/config/alacritty $HOME/.config/alacritty
}
backup() {
cp -r . ../dotfiles-$(date +"%s")
}
uninstall() {
unlink -f $HOME/.config/kitty
unlink -f $HOME/.zshrc
unlink -f $HOME/.config/starship.toml
unlink -f $HOME/.vimrc
unlink -f $HOME/.ideavimrc
unlink -f $HOME/bin
unlink -f $HOME/.config/gh-dash
unlink -f $HOME/.config/nvim
}
#######################################################################
## Main
#######################################################################
if [ "$#" -ne 1 ]; then
usage
exit 1
fi
command=$1
if [ $command = 'setup' ]; then
setup
elif [ $command = 'backup' ]; then
backup
elif [ $command = 'uninstall' ]; then
uninstall
else
usage
exit 1
fi