comparison piecrust/commands/builtin/info.py @ 567:a65f04ddbea2

showconfig: Don't crash when the whole config should be shown.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 13 Oct 2015 22:46:05 -0700
parents 794b047c9726
children ab5c6a8ae90a
comparison
equal deleted inserted replaced
566:8073ae8cb164 567:a65f04ddbea2
33 'path', 33 'path',
34 help="The path to a config section or value", 34 help="The path to a config section or value",
35 nargs='?') 35 nargs='?')
36 36
37 def run(self, ctx): 37 def run(self, ctx):
38 show = ctx.app.config.get(ctx.args.path) 38 if ctx.args.path:
39 show = ctx.app.config.get(ctx.args.path)
40 else:
41 show = ctx.app.config.getAll()
42
39 if show is not None: 43 if show is not None:
40 if isinstance(show, (dict, list)): 44 if isinstance(show, (dict, list)):
41 import yaml 45 import yaml
42 out = yaml.dump(show, default_flow_style=False, 46 out = yaml.dump(show, default_flow_style=False,
43 Dumper=ConfigurationDumper) 47 Dumper=ConfigurationDumper)