Mercurial > piecrust2
comparison piecrust/commands/base.py @ 0:a212a3f2e3ee
Initial commit.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 21 Dec 2013 14:44:02 -0800 |
parents | |
children | aaa8fb7c8918 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a212a3f2e3ee |
---|---|
1 import logging | |
2 | |
3 | |
4 logger = logging.getLogger(__name__) | |
5 | |
6 | |
7 class CommandContext(object): | |
8 def __init__(self, args, app): | |
9 self.args = args | |
10 self.app = app | |
11 | |
12 | |
13 class ChefCommand(object): | |
14 def __init__(self): | |
15 self.name = '__unknown__' | |
16 self.description = '__unknown__' | |
17 self.requires_website = True | |
18 | |
19 def setupParser(self, parser): | |
20 raise NotImplementedError() | |
21 | |
22 def run(self, ctx): | |
23 raise NotImplementedError() | |
24 | |
25 | |
26 class RootCommand(ChefCommand): | |
27 def __init__(self): | |
28 super(RootCommand, self).__init__() | |
29 self.name = 'root' | |
30 self.description = "Gets the root directory of the current website." | |
31 | |
32 def setupParser(self, parser): | |
33 pass | |
34 | |
35 def run(self, ctx): | |
36 logger.info(ctx.app.root) | |
37 |