Closed reckless-huang closed 5 months ago
What are the differences between ‘option(key, type, required, default, help) ’ and 'option("aaa") or defaut'
The IDE will automatically complete all keyword parameters, and you can use the parameters you need to delete other unnecessary parameters.
The function of option ("key") or "value"
is greater than that of option("key", default="value")
. The latter indicates that when the user does not set -D key=
by the CLI, the value is taken as "value". The former takes the value of both and use or
to calculate them, for example, even if the key is set, but the value of the key is empty e.g., "", False, None, etc, the value will still be taken as "value".
Got it. Can required and optional parameters be defined within the option?
Do you mean a = option("key", default="value", required=True)
?
This is the option prompt in the IDE, but it seems that the required and default here are not working properly. Also, is this writing method the same as defining a default value with option() or xxx?