summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2010-07-21 20:09:00 -0400
committerGuillaume Seguin <guillaume@segu.in>2010-07-21 20:09:00 -0400
commitec68a667db2bd734a0d48f570528dafbf63950d5 (patch)
tree751517e4f373bed761e18c8a4516b9b23742fac2
parent385bec0342ecc29b0bec5481edff41ad83090dc4 (diff)
downloadblogit-ec68a667db2bd734a0d48f570528dafbf63950d5.tar.gz
blogit-ec68a667db2bd734a0d48f570528dafbf63950d5.tar.bz2
Add raw interaction
-rw-r--r--raw_post42
1 files changed, 23 insertions, 19 deletions
diff --git a/raw_post b/raw_post
index edaf222..b5cee70 100644
--- a/raw_post
+++ b/raw_post
@@ -32,26 +32,30 @@ if "--unpack" in sys.argv:
print "Unpack only"
raise SystemExit
-title = raw_input ("Post title ? ")
-editor = "vi"
-if "VISUAL" in os.environ:
- editor = os.environ["VISUAL"]
-elif "EDITOR" in os.environ:
- editor = os.environ["EDITOR"]
-
-contents_path = os.path.join (repo, CONTENTS_FILE)
-
-ret = subprocess.call ([editor, contents_path])
-if ret == 0:
- contents = open (contents_path).read ()
- os.remove (contents_path)
+if "--raw" in sys.argv:
+ p = subprocess.Popen (["git", "commit", "--allow-empty"])
+ p.communicate ()
else:
- print "A problem occured while editing the contents file"
- raise SystemExit
-
-p = subprocess.Popen (["git", "commit", "--allow-empty", "-F", "-"],
- stdin = subprocess.PIPE)
-p.communicate ("%s\n\n%s" % (title, contents))
+ title = raw_input ("Post title ? ")
+ editor = "vi"
+ if "VISUAL" in os.environ:
+ editor = os.environ["VISUAL"]
+ elif "EDITOR" in os.environ:
+ editor = os.environ["EDITOR"]
+
+ contents_path = os.path.join (repo, CONTENTS_FILE)
+
+ ret = subprocess.call ([editor, contents_path])
+ if ret == 0:
+ contents = open (contents_path).read ()
+ os.remove (contents_path)
+ else:
+ print "A problem occured while editing the contents file"
+ raise SystemExit
+
+ p = subprocess.Popen (["git", "commit", "--allow-empty", "-F", "-"],
+ stdin = subprocess.PIPE)
+ p.communicate ("%s\n\n%s" % (title, contents))
if p.returncode == 0: print "New post successfully added"
else: