-
-
Notifications
You must be signed in to change notification settings - Fork 691
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] Support Capturing Unspecified Options with **kwargs #163
Comments
This would be super super nice. |
Using the underlying The |
Actually, I found support in |
That's perfect, thanks! |
Thanks for the help @PetrochukM ! 🍰 And thanks for closing the issue @n2cholas ☕
|
As nice as this is, the solution pointed to by @PetrochukM is not quite perfect for my hopes and dreams. The drawback is the required use of |
Is your feature request related to a problem
I would like to capture arbitrary options passed by the user that are not specified in the function siguature. When using
argparse
, I could doargs, unknown_args = parser.parse_known_args()
andunknown_args
would contain the unspecified options.The solution you would like
To me, it makes sense to capture unspecified options in the
**kwargs
dict. For example,Here's how you use it:
Since we don't specify the type of any of the
**kwargs
, they are captured as strings.Describe alternatives you've considered
sys.argv
. This is inelegant, though.*args
to capture unspecified options. However, I don't know how to implement this robustly, especially when it's possible for existing options to be a list.This has some drawbacks:
Additional context
The release notes for 0.3.0 talk about functionality that seems relevant to this, but I was not able to find documentation for it (says it was merged in #120 by @teymour-aldridge ).
Thanks in advance!
The text was updated successfully, but these errors were encountered: