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
Currently Clize converts each Python parameter to a Parameter instance by calling a function and using its result:
Either the first annotation on that parameter if it is a parameter converter,
or the default converter
This makes it impossible to use parameters.multi with parameters.one_of, for instance. This is counter-intuitive and also quite unfortunate.
To fix this, the parameter converter should collect callables from the annotations designated as "post-converters". Once the parameter converter has completed creating a Parameter instance, it should post-process this parameter with each post-converter in order. Each post converters does some changes and returns a Parameter instance, much like decorators.
Example post-converters:
parameter.one_of, parameter.mapped, (both already existing as parameter converters)
argument_decorator, (already existing as parameter converter)
Something to change the name of the value in the help (argparse calls it metavar)
UNDOCUMENTED and LAST_OPTION could be refactored as post-converters.
The documentation will need additional clarification on the roles of parameter converters, post-converters and value converters, possibly with a drawing :)
The text was updated successfully, but these errors were encountered:
Currently Clize converts each Python parameter to a
Parameter
instance by calling a function and using its result:This makes it impossible to use
parameters.multi
withparameters.one_of
, for instance. This is counter-intuitive and also quite unfortunate.To fix this, the parameter converter should collect callables from the annotations designated as "post-converters". Once the parameter converter has completed creating a
Parameter
instance, it should post-process this parameter with each post-converter in order. Each post converters does some changes and returns aParameter
instance, much like decorators.Example post-converters:
parameter.one_of
,parameter.mapped
, (both already existing as parameter converters)argument_decorator
, (already existing as parameter converter)argparse
calls it metavar)UNDOCUMENTED
andLAST_OPTION
could be refactored as post-converters.The documentation will need additional clarification on the roles of parameter converters, post-converters and value converters, possibly with a drawing :)
The text was updated successfully, but these errors were encountered: