# HG changeset patch # User Ludovic Chabant # Date 1427873258 25200 # Node ID f0fc2a9d3191c9ef619aa928ee5ed8b7e6aa6b3c # Parent de4903457bedd42d718f3a38d90931c091dcab28 showrecord: Add ability to filter on the output path. diff -r de4903457bed -r f0fc2a9d3191 piecrust/commands/builtin/baking.py --- a/piecrust/commands/builtin/baking.py Wed Apr 01 00:26:54 2015 -0700 +++ b/piecrust/commands/builtin/baking.py Wed Apr 01 00:27:38 2015 -0700 @@ -100,6 +100,10 @@ '-p', '--path', help="A pattern that will be used to filter the relative path " "of entries to show.") + parser.add_argument( + '-t', '--out', + help="A pattern that will be used to filter the output path " + "of entries to show.") def run(self, ctx): out_dir = ctx.args.output or os.path.join(ctx.app.root_dir, '_counter') @@ -110,6 +114,10 @@ if ctx.args.path: pattern = '*%s*' % ctx.args.path.strip('*') + out_pattern = None + if ctx.args.out: + out_pattern = '*%s*' % ctx.args.out.strip('*') + record_cache = ctx.app.cache.getCache('baker') if not record_cache.has(record_name): raise Exception("No record has been created for this output path. " @@ -126,9 +134,13 @@ logging.error("Status: failed") logging.info("Entries:") for entry in record.entries: - if pattern: - if not fnmatch.fnmatch(entry.rel_path, pattern): - continue + if pattern and not fnmatch.fnmatch(entry.rel_path, pattern): + continue + if out_pattern and not ( + any([o for o in entry.out_paths + if fnmatch.fnmatch(o, out_pattern)])): + continue + logging.info(" - ") logging.info(" path: %s" % entry.rel_path) logging.info(" spec: %s:%s" % (entry.source_name, @@ -160,9 +172,13 @@ logging.error("Status: failed") logging.info("Entries:") for entry in record.entries: - if pattern: - if not fnmatch.fnmatch(entry.rel_input, pattern): - continue + if pattern and not fnmatch.fnmatch(entry.rel_input, pattern): + continue + if out_pattern and not ( + any([o for o in entry.rel_outputs + if fnmatch.fnmatch(o, out_pattern)])): + continue + flags = [] if entry.flags & FLAG_PREPARED: flags.append('prepared')