diff piecrust/commands/builtin/util.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 c2ca72fb7f0b
children 81d9c3a3a0b5
line wrap: on
line diff
--- a/piecrust/commands/builtin/util.py	Tue Mar 01 22:27:04 2016 -0800
+++ b/piecrust/commands/builtin/util.py	Tue Mar 01 22:27:28 2016 -0800
@@ -4,7 +4,7 @@
 import codecs
 import logging
 import yaml
-from piecrust.app import CONFIG_PATH
+from piecrust.app import CONFIG_PATH, THEME_CONFIG_PATH
 from piecrust.commands.base import ChefCommand
 
 
@@ -19,7 +19,8 @@
         self.requires_website = False
 
     def setupParser(self, parser, app):
-        parser.add_argument('destination',
+        parser.add_argument(
+                'destination',
                 help="The destination directory in which to create the website.")
 
     def run(self, ctx):
@@ -31,6 +32,9 @@
             os.makedirs(destination, 0o755)
 
         config_path = os.path.join(destination, CONFIG_PATH)
+        if ctx.args.theme:
+            config_path = os.path.join(destination, THEME_CONFIG_PATH)
+
         if not os.path.isdir(os.path.dirname(config_path)):
             os.makedirs(os.path.dirname(config_path), 0o755)