-
Notifications
You must be signed in to change notification settings - Fork 11
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
feature request: defopt.run add append option #95
Comments
This and #96 both seem reasonable to me, but adding a global option to Off the top of my head, a possibly(?) better solution could be to exploit typing.Annotated here, e.g. |
I wonder if it makes more sense to use the annotated method as suggested here or to provide a dictionary to One potentially tricky issue to the dictionary method I've suggested is if the same argument could be passed to multiple commands with different behavior. |
My preference would be to use Annotated. I agree with your point about not changing the CLI function itself, but Annotated is spefically designed to include "context-specific metadata" (that's what its docs say), and CLI info seems suitable there. Your point about the |
We depend indirectly on typing_extensions (via typing_inspect), which brings in support for Annotated on older Pythons (in fact, we already (briefly) use Annotated internally, in defopt.signature). |
See https://docs.python.org/3/library/argparse.html#action:
'append'
- This stores a list, and appends each argument value to the list. This is useful to allow an option to be specified multiple times. Example usage:This feature request is to add an option to
defopt.run
s.t.parser.add_argument(..., action='append')
behavior can be toggled.The text was updated successfully, but these errors were encountered: