Commit a0924f49 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

[scripts][click_helper] Add exit message when config file is dumped; remove...

[scripts][click_helper] Add exit message when config file is dumped; remove default comment when option is required
parent b9c8ad18
......@@ -171,10 +171,10 @@ def dump_config(command, params, ctx):
if is not None:
config_file.write('## %s.\n' %
dflt='' if (param.required or False) else \
"[default: {}]".format(param.default)
'## Option: %s [default: %s]\n' % (
', '.join(param.opts), str(param.default)
'## Option: %s %s\n' % (', '.join(param.opts), dflt)
config_file.write('# %s = %s\n\n' % (,
......@@ -212,7 +212,11 @@ class ConfigCommand(click.Command):
help="Name of the config file to be generated")(self)
def invoke(self, ctx):
if ctx.params.get('dump_config') is not None:
dump_file = ctx.params.get('dump_config')
if dump_file is not None:
"Configuration file '{}' was written; exiting".format(dump_file)
return dump_config(self, self.params, ctx)
config_files = ctx.params[self.config_argument_name.lower()]
# load and normalize context from config files
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment