From 0c1cecc2adb685e444e921507caf5b713f9e3d16 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 22 Nov 2014 18:17:28 +0200 Subject: Move command edit to a separate class --- jt | 11 ++++++++--- 1 file 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: -- cgit v1.2.1