Mercurial > piecrust2
diff piecrust/main.py @ 663:3ceeca7bb71c
themes: Add support for a `--theme` argument to `chef`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 01 Mar 2016 22:27:28 -0800 |
parents | 9dd2f68f243b |
children | 81d9c3a3a0b5 |
line wrap: on
line diff
--- a/piecrust/main.py Tue Mar 01 22:27:04 2016 -0800 +++ b/piecrust/main.py Tue Mar 01 22:27:28 2016 -0800 @@ -40,7 +40,8 @@ class NullPieCrust: - def __init__(self): + def __init__(self, theme_site=False): + self.theme_site = theme_site self.root_dir = None self.debug = False self.templates_dirs = [] @@ -50,6 +51,9 @@ self.plugin_loader = PluginLoader(self) self.env = None + def useSubCache(self, cache_name, cache_key): + pass + def main(): if sys.platform == 'darwin': @@ -84,6 +88,10 @@ '--root', help="The root directory of the website.") parser.add_argument( + '--theme', + action='store_true', + help="Makes the current command apply to a theme website.") + parser.add_argument( '--config', dest='config_variant', help="The configuration variant to use for this command.") @@ -196,15 +204,19 @@ root = os.path.expanduser(pre_args.root) else: try: - root = find_app_root() + root = find_app_root(theme=pre_args.theme) except SiteNotFoundError: root = None if not root: - app = NullPieCrust() + app = NullPieCrust( + theme_site=pre_args.theme) else: - app = PieCrust(root, cache=(not pre_args.no_cache), - debug=pre_args.debug) + app = PieCrust( + root, + theme_site=pre_args.theme, + cache=(not pre_args.no_cache), + debug=pre_args.debug) # Build a hash for a custom cache directory. cache_key = 'default'