Created
June 20, 2016 09:12
-
-
Save ecomba/0b2bb2b2fc3b9c52603bfdeeb1392858 to your computer and use it in GitHub Desktop.
Mobbing with bash
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
function add_mobber() { | |
touch ~/.the_mob | |
echo $1:$2:$3 >> ~/.the_mob | |
} | |
function the_mob() { | |
echo $GIT_AUTHOR_NAME | |
} | |
function unmob() { | |
unset GIT_AUTHOR_NAME | |
unset GIT_AUTHOR_EMAIL | |
} | |
function mob() { | |
GIT_AUTHOR_NAME="" | |
GIT_AUTHOR_EMAIL="" | |
for nickname in $@; do | |
while read LINE | |
do | |
author=("${(@s/:/)LINE}") | |
if [[ $nickname == $author[1] ]]; then | |
GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME},$author[2] | |
GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL}+$author[3] | |
fi | |
done < ~/.the_mob | |
done | |
export GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME#?} | |
export GIT_AUTHOR_EMAIL=${${GIT_AUTHOR_EMAIL#?}}[email protected] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment