Skip to content

Instantly share code, notes, and snippets.

@lkdjiin
Created March 10, 2016 09:26
Show Gist options
  • Save lkdjiin/49721ccff3327802e0de to your computer and use it in GitHub Desktop.
Save lkdjiin/49721ccff3327802e0de to your computer and use it in GitHub Desktop.
Un début de git pair en Julia
#! /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