-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove-dots.sh
executable file
·60 lines (50 loc) · 1.8 KB
/
remove-dots.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
#!/usr/bin/env zsh
#test
SCRIPTS=$DOTFILES/install/scripts
DOTFILES=~/dotfiles
source $SCRIPTS/index.sh
setopt extended_glob
setopt NULL_GLOB
printf "\n\nRemoving dotfiles\n***"
dots=($DOTFILES/config/**/*.{dotfile,dotdir})
for dot in "${dots[@]/.\//}"; do
link_name=."$(echo "$dot" | xargs basename -s .dotfile | xargs basename -s .dotdir)"
echo "removing $link_name"
rm "$HOME/$link_name"
done
if [[ $(uname) == "Darwin" ]]; then
printf "\n\nRemoving mac specific symlinks\n***"
dots=($DOTFILES/config/**/*.{dotfile-mac,dotdir-mac})
for dot in "${dots[@]/.\//}"; do
link_name=."$(echo "$dot" | xargs basename -s .dotfile-mac | xargs basename -s .dotdir-mac)"
echo "removing $link_name"
rm "$HOME/$link_name"
done
fi
if command -v apt > /dev/null || command -v freebsd-version > /dev/null; then
printf "\n\nRemoving linux specific symlinks\n***"
dots=($DOTFILES/config/**/*.{dotfile-linux,dotdir-linux})
for dot in "${dots[@]/.\//}"; do
link_name=."$(echo "$dot" | xargs basename -s .dotfile-linux | xargs basename -s .dotdir-linux)"
echo "removing $link_name"
rm "$HOME/$link_name"
done
fi
if command -v apt > /dev/null; then
printf "\n\n Removing debian specific symlinks\n***"
dots=($DOTFILES/config/**/*.{dotfile-deb,dotdir-deb})
for dot in "${dots[@]/.\//}"; do
link_name=."$(echo "$dot" | xargs basename -s .dotfile-deb | xargs basename -s .dotdir-deb)"
echo "removing $link_name"
rm "$HOME/$link_name"
done
fi
if command -v freebsd-version > /dev/null; then
printf "\n\n Removing freebsd specific dotfiles"
dots=($DOTFILES/config/**/*.{dotfile-freebsd,dotdir-freebsd})
for dot in "${dots[@]/.\//}"; do
link_name=."$(echo "$dot" | xargs basename -s .dotfile | xargs basename -s .dotdir)"
echo "removing $link_name"
rm "$HOME/$link_name"
done
fi