Last active
October 7, 2020 08:34
-
-
Save sarangnx/1aa3d5637347d8da42e94f57fbf6196b to your computer and use it in GitHub Desktop.
bashrc settings
This file contains hidden or 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
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[ \1 ] /' | |
} | |
PS1="\[\033[02;37m\]\$(git_branch)\[\033[00m\]\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\W \[\033[00m\]\$ " | |
# Git commit using emoji | |
cm() { | |
# Menu | |
echo "[ 0 ] π feat" | |
echo "[ 1 ] π¨ fix" | |
echo "[ 2 ] π docs" | |
echo "[ 3 ] π style" | |
echo "[ 4 ] β¨ refactor" | |
echo "[ 5 ] π test" | |
echo "[ 6 ] π» chore" | |
echo "[ 7 ] π¦ deps" | |
# take user input | |
# -n 1 takes 1 character input | |
# -s does not echo user input | |
read -n 1 -s option | |
# array of prefixes | |
prefixes=( "π feat" "π¨ fix" "π docs" "π style" "β¨ refactor" "π test" "π» chore" "π¦ deps" ) | |
if ! [[ $option =~ ^[0-7]$ ]]; then | |
echo "Invalid Selection π" | |
return | |
fi | |
git commit -m "${prefixes[$option]}: $@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment