You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current behavior is a bug, but I'm unsure whether it's a good idea to just inline the return value of the lambda? IMO it's better to describe the default callback's logic in the option helptext.
In #844, the suggestion is made to evaluate the default value when running --help. This seems possibly dangerous or ripe for exploitation if the lambda on the option ran something which updates a database, writes to a file, etc.
Instead, I'm working on a fix for this that adds a new optional parameter to @click.option to be used to give a description of what the dynamic value would be.
Activity
untitaker commentedon Apr 1, 2016
The current behavior is a bug, but I'm unsure whether it's a good idea to just inline the return value of the lambda? IMO it's better to describe the default callback's logic in the option helptext.
jcejohnson commentedon Apr 1, 2016
I think I agree but it would also be nice to have the option for --help to invoke the function.
blueyed commentedon Nov 28, 2017
JFI: the code in question:
click/click/core.py
Lines 1635 to 1639 in defe6ae
dougharris commentedon May 14, 2018
In #844, the suggestion is made to evaluate the default value when running
--help. This seems possibly dangerous or ripe for exploitation if thelambdaon the option ran something which updates a database, writes to a file, etc.Instead, I'm working on a fix for this that adds a new optional parameter to
@click.optionto be used to give a description of what the dynamic value would be.Better handling of help text for dynamic default option values for pa…
Better handling of help text for dynamic default option values for pa…