Open bnorick opened 5 months ago
Hey there @bnorick, thanks for posting!
Those globals seem not ideal.
Totally agree. I definitely need to remove those global vars. One idea could be to preserve the kwargs on the ArgumentParser so that parser.add_subparsers
transfers them. I'll have to try that out.
Describe the bug When
argparse
creates a newsimple_parsing.ArgumentParser
in the call toparser.add_subparsers
it doesn't pass the original kwargs (obviously), so the global class attributes onFieldWrapper
likeadd_dash_variants
get overwritten with the defaults.Your refactor may address this, but in case you weren't aware I thought I'd raise the issue. Those globals seem not ideal.
Here's a workaround:
To Reproduce Use subparsers with non-default kwargs on the top level parser, e.g.,
add_dash_variants
.Expected behavior Subparsers obey the kwargs used by the parent.
Actual behavior Subparsers use default kwargs.
Desktop (please complete the following information):