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 PassUnknownFlagsToArgs to allow get unknown flags via Args() #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ikedam
Copy link

@ikedam ikedam commented Dec 11, 2021

Close #337

FlagSet.ParseErrorsWhitelist.UnknownFlags=true behaves like this:

  • Input:
    -xayb -c -z --known-flag known-flag-value --unknown-flag arg0 arg1 arg2
    
    • -x, -y, -z and --unknown-flag are unknown
  • Args():
    arg1 arg2
    

This request adds FlagSet.ParseErrorsWhitelist.PassUnknownFlagsToArgs, and setting it to true results following behavior:

  • Args() with FlagSet.ParseErrorsWhitelist.PassUnknownFlagsToArgs=true:
    -xy -z --unknown-flag arg0 arg1 arg2
    

Any unknown and unprocessed flags are passed to Args().

@CLAassistant
Copy link

CLAassistant commented Dec 11, 2021

CLA assistant check
All committers have signed the CLA.

@jippi
Copy link

jippi commented May 9, 2023

@spf13 👋 Any chance of this landing? I have exactly this use-case as well :)

If it needs work, I would be happy to take it on

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.

Preserve unknown flags
3 participants