Commit 42108fc5 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

[script][click_helper] Add entries information when ResourceOptions are used

parent 66df3b55
from ..log import set_verbosity_level
from ..config import load, mod_to_context
from ..utils import resource_keys
import time
import click
import logging
......@@ -171,11 +172,16 @@ 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)
dflt='' if param.required or (isinstance(param, ResourceOption) and
param.real_required) else \
"[default: {}]".format(param.default)
'## Option: %s %s\n' % (', '.join(param.opts), dflt)
if isinstance(param, ResourceOption) and param.entry_point_group is not\
config_file.write("## registered entries are: {}\n".format(
config_file.write('# %s = %s\n\n' % (,
......@@ -303,7 +309,6 @@ class ResourceOption(click.Option):
while isinstance(value, basestring):
value = load([value], entry_point_group=self.entry_point_group)
value = getattr(value, keyword)
return value
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