def set_help_from_yaml(cls, ctx, param, value):
"""
When attaching this function as `callback` argument to an Option (`click.Option`),
it will set
an automatic help for all Options of the same command, which do not have an `help`
specified and are found in the default config file for downloading
(currently `download.yaml`).
The Option having as callback this function must also have `is_eager=True`.
Example:
Assuming opt1, opt2, opt3 are variables of the config yaml file, and opt4 not, this
sets the default help for opt1 and opt2:
\@click.Option('--opt1', ..., callback=set_help_from_yaml, is_eager=True,...)
\@click.Option('--opt2'...)
\@click.Option('--opt3'..., help='my custom help do not set the config help')
\@click.Option('--opt4'...)
...
```
"""
cfg_doc = cls.DEFAULTDOC
for option in (opt for opt in ctx.command.params if opt.param_type_name == 'option'):
if option.help is None:
option.help = cfg_doc.get(option.name, None)
return value
```