Closed rggjan closed 3 years ago
Hey again @rggjan, thanks for posting!
Sounds good! And would also be pretty easy to add, so I'll look into this soon. I'll perhaps end up adding another Enum for the option for that, a bit like for ConflictResolution
.
Hey @rggjan, Sorry it's been a while.
I'd really appreciate someone making a PR for this, since the change would be pretty simple (and quite similar to what I describe in #75):
- First, take a look at how the
FieldWrapper
currently creates the option strings:- then, take a look at how they are used in the
DataclassWrapper
to actually create the arguments:You'd need to either change what value is returned by the
option_strings
property so it only includes the full path (thedest
attribute on theFieldWrapper
), or filter out the option strings that are passed to theadd_argument
function.
In this case, there could also be some kind of enum that gets passed to the ArgumentParser
constructor, that defines what style of option strings to use, something like:
class OptionStringStyle(enum.Enum):
DEFAULT = 0
WITH_DASHES = 1
ONLY_DASHES = 2
Hope this helps! Let me know what you think!
Thanks for the info and hints, makes sense! Not sure if / when I can take a look at this, though.
Fixed by #93
There is an option
add_option_string_dash_variants
:However, this always creates two versions of the same option and clutters the help:
It would be nice to have the option to disable the underscore variants and only use the dash variants (for people preferring dashes):