Last active
January 1, 2021 00:06
-
-
Save snowfag/7eac28fc0628dcc86fc71b12e25a8c40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [[ -d ${HOME}/.cfg ]]; then | |
if read -q "choice?${HOME}/.cfg exists would you like to delete it? Y/n: "; then | |
rm -rf "${HOME}/.cfg" | |
else | |
exit 1 | |
fi | |
fi | |
git clone --bare git@github.com:snowfag/dotfiles.git ${HOME}/.cfg | |
config() git --git-dir=${HOME}/.cfg/ --work-tree=${HOME} $@ | |
if config checkout 2>&1 >/dev/null; then | |
echo "Checked out config." | |
else | |
echo "Backing up pre-existing dot files." | |
OLDFILES=$(mktemp -d) | |
config checkout 2>&1 | egrep "\s+\." | cut -f 2 | xargs -I{} mv "{}" "${OLDFILES}/{}" | |
config checkout | |
config config status.showUntrackedFiles no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment