Created
April 14, 2013 12:51
-
-
Save onemach/5382603 to your computer and use it in GitHub Desktop.
My Writing Utility
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
#!/usr/bin/env python | |
import sys | |
import os | |
def create(name): | |
file = open(os.environ['HOME'] + "/.onemach/essay_remote") | |
gitRemote = file.readline().strip() | |
if not gitRemote: | |
pass #error | |
os.system("git clone " + gitRemote + " " + name) | |
os.chdir(name) | |
os.system("git checkout -b " + name + " master") | |
file = open(".writing_branch", "w+") | |
file.write(name) | |
def sync(name): | |
os.chdir(name) | |
os.system("git commit -am nothing") | |
file = open(".writing_branch") | |
branch = file.readline().strip() | |
os.system("git push origin " + branch) | |
if __name__ == "__main__": | |
cmd = sys.argv[1] | |
if cmd == "create": | |
create(sys.argv[2]) | |
elif cmd == "sync": | |
sync(sys.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment