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

ArgparseArgumentHandler Should Store Unknown Arguments #390

Closed
derks opened this Issue Jul 11, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@derks
Member

derks commented Jul 11, 2016

Currently, ArgparseArgumentHandler uses parse(), which throws an error for any unknown arguments. Generally this is fine, but there are plenty of use cases where you might not want that or that you want to capture unknown args (See Issue #384).

For backward compat, we could simply store unknown arguments in ArgparseArgumentHandler._unknown_arguments, but later on we should maybe redefine the interface to require parse() to return a tuple of (known_arguments, unknown_arguments). This may or not be ideal (needs further thought/testing).

@derks derks added the portland label Jul 11, 2016

@derks derks added this to the 3.0.0 Stable milestone Jul 11, 2016

@derks derks added stable/2.10.x and removed portland labels Jul 12, 2016

@derks derks modified the milestones: 2.10.0 Stable, 3.0.0 Stable Jul 12, 2016

@derks derks self-assigned this Jul 12, 2016

@derks derks added the 1 - Ready label Jul 12, 2016

derks added a commit that referenced this issue Jul 13, 2016

derks added a commit that referenced this issue Jul 13, 2016

@derks derks added 3 - Review and removed 1 - Ready labels Jul 13, 2016

@derks derks closed this Jul 13, 2016

@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Jul 13, 2016

Member

This has been implemented as ArgparseArgumentHandler.Meta.ignore_unknown_arguments. Default is False (current behavior), but if True we use parse_known_args(), and store the unknown arguments as ArgparseArgumentHandler.unknown_args.

Member

derks commented Jul 13, 2016

This has been implemented as ArgparseArgumentHandler.Meta.ignore_unknown_arguments. Default is False (current behavior), but if True we use parse_known_args(), and store the unknown arguments as ArgparseArgumentHandler.unknown_args.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment