Mercurial > piecrust2
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piecrust/commands/base.py Sat Dec 21 14:44:02 2013 -0800 @@ -0,0 +1,37 @@ +import logging + + +logger = logging.getLogger(__name__) + + +class CommandContext(object): + def __init__(self, args, app): + self.args = args + self.app = app + + +class ChefCommand(object): + def __init__(self): + self.name = '__unknown__' + self.description = '__unknown__' + self.requires_website = True + + def setupParser(self, parser): + raise NotImplementedError() + + def run(self, ctx): + raise NotImplementedError() + + +class RootCommand(ChefCommand): + def __init__(self): + super(RootCommand, self).__init__() + self.name = 'root' + self.description = "Gets the root directory of the current website." + + def setupParser(self, parser): + pass + + def run(self, ctx): + logger.info(ctx.app.root) +