Skip to content

Instantly share code, notes, and snippets.

@ecomba
Created June 20, 2016 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecomba/0b2bb2b2fc3b9c52603bfdeeb1392858 to your computer and use it in GitHub Desktop.
Save ecomba/0b2bb2b2fc3b9c52603bfdeeb1392858 to your computer and use it in GitHub Desktop.
Mobbing with bash
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#?}}+your_group@server.com
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment