-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathyrules
45 lines (38 loc) · 1.15 KB
/
yrules
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
defaultTarget="all"
declare -A dotpaths
dotfiles=("ackrc aprc aria2/aria2.conf gitconfig lftprc pryrc tmux.conf vim vimrc zsh zshrc /bin/sack /bin/sag /bin/sgrep sackrc percol.d spacemacs.d hammerspoon")
dotpaths[zshrc]="zsh/zshrc"
dotpaths[".config/nvim"]="nvim"
dotpaths[".vim"]="nvim"
dotpaths[vimrc]="nvim/init.vim"
dotpaths[gitconfig]="git/gitconfig"
dotpaths["aria2/aria2.conf"]="aria2.conf"
dotpaths["/bin/sack"]="sack/sack"
dotpaths["/bin/sag"]="sack/sag"
dotpaths["/bin/sgrep"]="sack/sgrep"
dotpaths["emacs.d/private"]="spacemacs/private"
dep_all() {
local deps=""
for i in ${dotfiles}; do
deps=$(lappend "$deps" "symlink_dot_$i")
done
echo $deps
}
cmd_all() {
dlog "making all"
}
mapTarget 'symlink_dot_*' symlink_dot
test_symlink_dot() {
eval target=${1/symlink_dot_/~\/.}
dlog "testing target $target"
! test -e $target
}
cmd_symlink_dot() {
local dotfile=${1/symlink_dot_}
local target=${dotpaths[$dotfile]}
if [[ -z "$target" ]]; then local target="$dotfile"; fi
dlog "symlinking dotfile $dotfile to target $target"
eval fullpath=`dirname "~/.$dotfile"`
mkdir -p "$fullpath"
ln -sf ~/.dotfiles/$target ~/.$dotfile
}