Mercurial > piecrust2
diff piecrust/commands/builtin/baking.py @ 868:8d25f76fce98
bake: Add ability to specify pipelines to exclude during the bake.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 12 Jun 2017 22:22:19 -0700 |
parents | 08e02c2a2a1a |
children | 3004ab31bb46 |
line wrap: on
line diff
--- a/piecrust/commands/builtin/baking.py Mon Jun 12 22:20:58 2017 -0700 +++ b/piecrust/commands/builtin/baking.py Mon Jun 12 22:22:19 2017 -0700 @@ -88,21 +88,27 @@ ctx.app.config.set('baker/batch_size', ctx.args.batch_size) allowed_pipelines = None + forbidden_pipelines = None if ctx.args.html_only: - allowed_pipelines = ['page'] + forbidden_pipelines = ['asset'] elif ctx.args.assets_only: allowed_pipelines = ['asset'] elif ctx.args.pipelines: - if allowed_pipelines: + if allowed_pipelines or forbidden_pipelines: raise Exception( "Can't specify `--html-only` or `--assets-only` with " "`--pipelines`.") - allowed_pipelines = ctx.args.pipelines + for p in ctx.args.pipelines: + if p[0] == '-': + forbidden_pipelines.append(p) + else: + allowed_pipelines.append(p) baker = Baker( ctx.appfactory, ctx.app, out_dir, force=ctx.args.force, - allowed_pipelines=allowed_pipelines) + allowed_pipelines=allowed_pipelines, + forbidden_pipelines=forbidden_pipelines) records = baker.bake() return records