Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to omit prefixes while keeping groups #251

Closed
wants to merge 1 commit into from

Conversation

e3rd
Copy link
Contributor

@e3rd e3rd commented Feb 5, 2025

And this is my second wish. My big project uses many argparsers. For backward compatiblity, I do not want to impose the usrs to change all the flags to its subparser variants --model.x instead of --x. But I really need to keep the help text divided into groups.

This marker adds the functionality, help text displaying groups, while omitting the args prefixes. How it should be done so that you can accept the feature please?

@brentyi
Copy link
Owner

brentyi commented Feb 6, 2025

Thanks for the PR @e3rd!

For this feature specifically: we could also change the default behavior of OmitArgPrefixes to always keep the helptext groups. This is just cosmetic, so I'm fine with being a little bit prescriptive.

For that route the change might be much easier. We could delete the group_name_from_arg() function in _parsers.py and instead set group_name = arg.extern_prefix. There's probably some tests that would need to be updated.

What do you think?

@e3rd
Copy link
Contributor Author

e3rd commented Feb 6, 2025

Yeah, this would seem to me much cleaner but I did not dare to propose it myself as I don't know all the side use cases you may be aware of.

@e3rd
Copy link
Contributor Author

e3rd commented Feb 6, 2025

I've changed the default behaviour in another PR and this one can be closed :)

@e3rd e3rd closed this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants