Skip to content

Commit

Permalink
cleaner dotfile exclusion when symlinking on setup
Browse files Browse the repository at this point in the history
  • Loading branch information
essmahr committed Apr 13, 2018
1 parent a3c1644 commit bfc3c1c
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,17 @@ success() {
printf "\r\033[00;32m[ !! ] »\033[0m $1\n"
}

contains() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [ "${!i}" == "${value}" ]; then
echo true
return 0
fi
}
echo false
return 1
}

link() {
rm -f "$2"
ln -s "$1" "$2"
}

begin() {
exclusions=(".DS_Store" "README.md", "setup.sh", ".git", "LICENSE-MIT.txt")

# Symlink all the things
user "Symlinking dotfiles."
for file in .[^.]*; do
if [ $(contains "${exclusions[@]}" "$file") == false ]; then
link "`pwd`/$file" "$HOME/$file"
fi
[[ $file =~ (.git|.DS_Store)$ ]] && continue
link "`pwd`/$file" "$HOME/$file"
done
info "Dotfiles symlinked."

Expand Down

0 comments on commit bfc3c1c

Please sign in to comment.