-
-
Save jcelliott/6335485 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 bash | |
# ~/bin/home | |
# toggles source control on my home directory | |
# idea from [http://rhodesmill.org/brandon/2012/home-directory-vc/] | |
# colorized output | |
function cinfo() { | |
echo -e "\x1b[32m$1\x1b[0m" # green | |
} | |
function cwarn() { | |
echo -e "\x1b[33m$1\x1b[0m" # yellow | |
} | |
function cerror() { | |
echo -e "\x1b[31m$1\x1b[0m" # red | |
} | |
if [ -d $HOME/.git.off ]; then | |
mv $HOME/.git.off ~/.git || exit 1 | |
cinfo "home directory version control activated" | |
elif [ -d $HOME/.git ]; then | |
mv $HOME/.git $HOME/.git.off || exit 1 | |
cwarn "home directory version control deactivated" | |
else | |
cerror "home directory is not under version control" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment