Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 54 lines (43 sloc) 1.042 kB
#!/usr/bin/env rc
# tuple - simple git pairing script
#
# basic usage: ./tuple jn cw
tuples = $HOME/.tuple
org_email = bendyworks.com
if(test $#* -lt 1) {
echo unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
exit 0
}
if(~ $1 -h) {
echo Usage:
echo $0 initials_0 initials_1...
exit 0
}
if(test ! -f $tuples) {
echo Missing .tuple file in your $HOME directory
exit 1
}
fn get_name { grep $1 $tuples | cut -f 3 | tr '\n' '\0' }
fn get_user { grep $1 $tuples | cut -f 2 }
fn build_author_name {
names = `{get_name $1}
for(a in $*(2-)) {
names = ($names and `{get_name $a})
}
names = $"names
echo -n $"names
}
fn build_author_email {
email = 'dev+'^`{get_user $1}
for(e in $*(2-)) {
email = $email'+'`{get_user $e}
}
email = $email'@'$org_email
echo -n $"email
}
# main
sorted_inits = `{sort <{echo $"* | tr ' ' '\n'}}
name=`{build_author_name $sorted_inits}
mail=`{build_author_email $sorted_inits}
echo GIT_AUTHOR_NAME'='''$"name'''; export GIT_AUTHOR_NAME;'
echo GIT_AUTHOR_EMAIL'='''$"mail'''; export GIT_AUTHOR_EMAIL;'
Jump to Line
Something went wrong with that request. Please try again.