summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjt26
1 files changed, 16 insertions, 10 deletions
diff --git a/jt b/jt
index 9c54f14..ad02c62 100755
--- a/jt
+++ b/jt
@@ -108,6 +108,21 @@ class AttachCommand(Command):
shutil.copy(filename, dirname)
+class RemoveCommand(Command):
+
+ def run(self, args):
+ if not args:
+ raise cliapp.AppException('Usage: journal-note remove ID')
+
+ filename = self._app.draft_name(args[0])
+ os.remove(filename)
+
+ dirname, ext = os.path.splitext(filename)
+ assert ext == '.mdwn'
+ if os.path.exists(dirname):
+ shutil.rmtree(dirname)
+
+
class JournalTool(cliapp.Application):
cmd_synopsis = {
@@ -216,16 +231,7 @@ class JournalTool(cliapp.Application):
def cmd_remove(self, args):
'''Remove a draft.'''
-
- if not args:
- raise cliapp.AppException('Usage: journal-note remove ID')
- filename = self.draft_name(args[0])
- os.remove(filename)
-
- dirname, ext = os.path.splitext(filename)
- assert ext == '.mdwn'
- if os.path.exists(dirname):
- shutil.rmtree(dirname)
+ RemoveCommand(self).run(args)
def cmd_finish(self, args):
'''Publish a draft journal entry.'''