Only link files and folders explicitly contained in the repo

This commit is contained in:
Kevin Cotugno 2018-08-07 09:14:46 -07:00
parent c3749151dd
commit ecd5bd2022

View File

@ -1,21 +1,42 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
## TODO walk the file tree instead of manually linking files
link="ln -s" link="ln -s"
rm="rm -rf" rm="rm -rf"
emacs_dir="$HOME/.emacs.d"
nvim_dir="$HOME/.config/nvim"
function create_directories {
if [[ ! -d "$emacs_dir" ]]; then
mkdir "$emacs_dir"
fi
if [[ ! -d "$nvim_dir" ]]; then
mkdir "$nvim_dir"
fi
}
function uninstall { function uninstall {
eval $rm "$HOME/.zshrc" eval $rm "$HOME/.zshrc"
eval $rm "$HOME/.emacs.d" eval $rm "$emacs_dir/init.el"
eval $rm "$emacs_dir/themes"
eval $rm "$HOME/.tmux.conf" eval $rm "$HOME/.tmux.conf"
eval $rm "$HOME/.config/nvim" eval $rm "$nvim_dir/autoload"
eval $rm "$nvim_dir/init.vim"
eval $rm "$HOME/.Xresources" eval $rm "$HOME/.Xresources"
} }
function install { function install {
eval $link "$PWD/.emacs.d" "$HOME/.emacs.d" create_directories
eval $link "$PWD/.emacs.d/init.el" "$emacs_dir/init.el"
eval $link "$PWD/.emacs.d/themes/" "$emacs_dir/themes"
eval $link "$PWD/.zshrc" "$HOME/.zshrc" eval $link "$PWD/.zshrc" "$HOME/.zshrc"
eval $link "$PWD/.tmux.conf" "$HOME/.tmux.conf" eval $link "$PWD/.tmux.conf" "$HOME/.tmux.conf"
eval $link "$PWD/.config/nvim" "$HOME/.config/nvim" eval $link "$PWD/.config/nvim/autoload" "$nvim_dir/autoload"
eval $link "$PWD/.config/nvim/init.vim" "$nvim_dir/init.vim"
which xrdb &> /dev/null which xrdb &> /dev/null
xrdb_exists=$? xrdb_exists=$?