summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-12-07 10:29:26 +0000
committerLars Wirzenius <liw@liw.fi>2010-12-07 10:29:26 +0000
commitfe1f315c63a889136a8fba1cdd6b22406bb768c2 (patch)
treec3eb7f83ca5de5035e0251b66b62297c2f7aa646
parent338b1caaee28d4b01a1b2c3a168b201033ebfc9f (diff)
downloadliw-automation-fe1f315c63a889136a8fba1cdd6b22406bb768c2.tar.gz
Make edit and finish accept draft ids not full basenames as args.
-rwxr-xr-xscripts/journal-note8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/journal-note b/scripts/journal-note
index 60ab9c0..315a27c 100755
--- a/scripts/journal-note
+++ b/scripts/journal-note
@@ -105,13 +105,17 @@ class App(object):
def edit_entry(self, args, opts):
if not args:
raise AppException('Usage: journal-note edit ID')
- pathname = os.path.join(self.drafts(opts), args[0])
+ pathname = os.path.join(self.drafts(opts), args[0] + '.mdwn')
+ if not os.path.exists(pathname):
+ raise AppException('draft %s does not exist' % args[0])
subprocess.check_call(['gedit', '--new-window', pathname])
def finish_entry(self, args, opts):
if not args:
raise AppException('Usage: journal-note finish ID')
- draft = os.path.join(self.drafts(opts), args[0])
+ draft = os.path.join(self.drafts(opts), args[0] + '.mdwn')
+ if not os.path.exists(draft):
+ raise AppException('draft %s does not exist' % args[0])
basename = time.strftime('%Y-%m-%d-%H:%M.mdwn')
i = 0
while True: