diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-12-07 10:29:26 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-12-07 10:29:26 +0000 |
commit | fe1f315c63a889136a8fba1cdd6b22406bb768c2 (patch) | |
tree | c3eb7f83ca5de5035e0251b66b62297c2f7aa646 | |
parent | 338b1caaee28d4b01a1b2c3a168b201033ebfc9f (diff) | |
download | liw-automation-fe1f315c63a889136a8fba1cdd6b22406bb768c2.tar.gz |
Make edit and finish accept draft ids not full basenames as args.
-rwxr-xr-x | scripts/journal-note | 8 |
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: |