diff options
Diffstat (limited to 'scripts/journal-note')
-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: |