Last active
February 22, 2024 16:53
-
-
Save cesarLDsousa/034dfccdcea701286c8beeda884dfba3 to your computer and use it in GitHub Desktop.
Github and Bitbucket configuration for .zshrc
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
# colors | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
GRAY='\033[0;37m' | |
BLUE='\033[0;94m' | |
YELLOW='\033[0;33m' | |
NC='\033[0m' # No Color | |
# emojis | |
SUCCESS_EMOJI="✅" | |
ERROR_EMOJI="❌" | |
WARNING_EMOJI="⚠️" | |
# font | |
BOLD='\033[1m' | |
# github configuration | |
function git_config { | |
git config --global user.name "cesarLDsousa" | |
git config --global user.email "cesarluiz.git@gmail.com" | |
git_config_return_code=$? | |
if [ $git_config_return_code -eq 0 ]; then | |
echo -e "${SUCCESS_EMOJI} ${GREEN}${BOLD}Changed settings to ${GRAY} Github:${NC}" | |
else | |
echo -e "${ERROR_EMOJI} ${RED}Settings not changed${NC}" | |
fi | |
} | |
# bitbucket configuration | |
function git_config_bitbucket { | |
git config --global user.name "cesarLDsousa" | |
git config --global user.email "cesar.luiz@essentia.com.br" | |
git_config_return_code=$? | |
if [ $git_config_return_code -eq 0 ]; then | |
echo -e "${SUCCESS_EMOJI} ${GREEN}${BOLD}Changed settings to ${BLUE}Bitbucket:${NC}" | |
else | |
echo -e "${ERROR_EMOJI} ${RED}!! Settings not changed: error !!${NC}" | |
fi | |
} | |
# select git configuration based on argument | |
function git-config { | |
if [ "$1" = "--github" ]; then | |
git_config | |
elif [ "$1" = "--bitbucket" ]; then | |
git_config_bitbucket | |
else | |
echo -e "${WARNING_EMOJI} ${YELLOW} Origin not recognized.${NC}" | |
fi | |
git config --list | grep user | sed 's/^/ /' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment