view 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 source

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)