summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-11-22 18:17:28 +0200
committerLars Wirzenius <liw@liw.fi>2014-11-22 18:17:28 +0200
commit0c1cecc2adb685e444e921507caf5b713f9e3d16 (patch)
tree47fa94c29aa22b2b4c023d1cc70ecdfb51d14cf6
parentb4f6ae94f5adaf6838a014c39a264c6f187e17b3 (diff)
downloadjt-0c1cecc2adb685e444e921507caf5b713f9e3d16.tar.gz
Move command edit to a separate class
-rwxr-xr-xjt11
1 files changed, 8 insertions, 3 deletions
diff --git a/jt b/jt
index b2c9a25..59e4c46 100755
--- a/jt
+++ b/jt
@@ -84,6 +84,13 @@ class ListCommand(Command):
print draft_id, self._app.get_draft_title(filename) or ""
+class EditCommand(Command):
+
+ def run(self, args):
+ filename = self._app.choose_draft(args)
+ self._app.edit_file(filename)
+
+
class JournalTool(cliapp.Application):
cmd_synopsis = {
@@ -168,9 +175,7 @@ class JournalTool(cliapp.Application):
def cmd_edit(self, args):
'''Edit a draft journal entry.'''
-
- filename = self.choose_draft(args)
- self.edit_file(filename)
+ EditCommand(self).run(args)
def choose_draft(self, args):
if len(args) == 0: