Created
March 10, 2016 09:26
-
-
Save lkdjiin/49721ccff3327802e0de to your computer and use it in GitHub Desktop.
Un début de git pair en Julia
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
#! /usr/bin/env julia | |
content = readall(expanduser("~/.git-pair-backup")) | |
user, email = split(content, "\n") | |
add_to_user() = "$user and $(ARGS[1])" | |
function add_to_email() | |
oldname, endmail = split(email, "@") | |
"$(oldname)+$(ARGS[1])@$(endmail)" | |
end | |
function gitconfig(newuser, newmail) | |
run(`git config --global user.name $newuser`) | |
run(`git config --global user.email $newmail`) | |
end | |
if length(ARGS) > 0 | |
gitconfig(add_to_user(), add_to_email()) | |
else | |
gitconfig(user, email) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment