diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-11-22 18:17:28 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-11-22 18:17:28 +0200 |
commit | 0c1cecc2adb685e444e921507caf5b713f9e3d16 (patch) | |
tree | 47fa94c29aa22b2b4c023d1cc70ecdfb51d14cf6 | |
parent | b4f6ae94f5adaf6838a014c39a264c6f187e17b3 (diff) | |
download | jt-tmp-0c1cecc2adb685e444e921507caf5b713f9e3d16.tar.gz |
Move command edit to a separate class
-rwxr-xr-x | jt | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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: |