summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-11-22 18:16:16 +0200
committerLars Wirzenius <liw@liw.fi>2014-11-22 18:16:16 +0200
commit572b72fb46c81931b16c26085907f4b66c04fcca (patch)
tree98f64ec2defdac653eb78b119e93907bf07b1e74
parenta6eb8b13949dcdb85cb176e354f711de9600d400 (diff)
downloadjt-572b72fb46c81931b16c26085907f4b66c04fcca.tar.gz
Move command list to a separate class
-rwxr-xr-xjt11
1 files changed, 8 insertions, 3 deletions
diff --git a/jt b/jt
index 9540d92..65e31f5 100755
--- a/jt
+++ b/jt
@@ -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()