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

Ability to ignore unknown flags #623

Closed
rajatjindal opened this issue Jan 29, 2018 · 3 comments · Fixed by #662
Closed

Ability to ignore unknown flags #623

rajatjindal opened this issue Jan 29, 2018 · 3 comments · Fixed by #662

Comments

@rajatjindal
Copy link
Contributor

I am trying to write something like follows:

original() {
./mycobracmd cmd1 $@
./original $@
}

I do something based on the subset of flags implemented by original command, and want to ignore rest of the flags.

Do you think this can be implemented. I will be more than happy to do a PR if acceptable.

@svend
Copy link

svend commented Feb 14, 2018

I have a use for this as well. I have a wrapper for kubernetes CLI tools like kubectl and helm, and I need to parse the context flag, and ignore the other flags. Currently I'm using Python's parse_known_args().

@rajatjindal
Copy link
Contributor Author

I have got this working on with changes to pflag and cobra in my vendor directory, but changes are really ugly

Once i have some more time i will try to make them less ugly and open pr

@rajatjindal
Copy link
Contributor Author

I've opened spf13/pflag#160 to support unknown flags in pflag.

once (and if) that PR is approved, I have changes ready for Cobra PR.

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 a pull request may close this issue.

2 participants