diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-11-22 18:16:16 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-11-22 18:16:16 +0200 |
commit | 572b72fb46c81931b16c26085907f4b66c04fcca (patch) | |
tree | 98f64ec2defdac653eb78b119e93907bf07b1e74 | |
parent | a6eb8b13949dcdb85cb176e354f711de9600d400 (diff) | |
download | jt-572b72fb46c81931b16c26085907f4b66c04fcca.tar.gz |
Move command list to a separate class
-rwxr-xr-x | jt | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -77,6 +77,13 @@ class NewCommand(Command): self._app.edit_file(name) +class ListCommand(Command): + + def run(self, args): + for draft_id, filename in self.find_drafts(): + print draft_id, self.get_draft_title(filename) or "" + + class JournalTool(cliapp.Application): cmd_synopsis = { @@ -137,9 +144,7 @@ class JournalTool(cliapp.Application): def cmd_list(self, args): '''List journal entry drafts.''' - - for draft_id, filename in self.find_drafts(): - print draft_id, self.get_draft_title(filename) or "" + ListCommand(self).run(args) def find_drafts(self): drafts_dir = self.drafts_dir() |