-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Documentation for back-quoted flag usage #2125
Comments
Believe it or not I also actually found out about this a few weeks ago! So I agree that it would be nice to document in cobra. Also, shell completion which automatically provides descriptions of flags does not respect this format. @calebstewart I encourage you to submit a PR for the documentation. And if you want, a PR for shell completion would also be appreciated |
Come on! |
I learned about this today reviewing #2105 :-) Shouldn't this be documented in the pflags package? |
I apologize for losing track of this issue. It seems from the discussion, and after reading back over everything that it makes the most sense to add this documentation to |
This may be better suited in the
spf13/pflag
project, but my expectation is that more people use Cobra than pflag directly. I was recently using Cobra to parse a custom repeated argument in the form--option KEY=VALUE
. When using.StringArray()
, the usage looks like this by default:This isn't terrible, but "stringArray" is not helpful in this context. I went digging in the documentation and code and ended up finding the UnquoteUsage function. It seems that providing a usage like:
Will result in the following usage:
This is exactly what I wanted, however there's no documentation anywhere that I could find.
If this is better opened over in pflag, let me know, and I can reopen over there. If I've missed where this functionality is documented, then no worries. I just wanted to surface it to help someone else in the future. :)
The text was updated successfully, but these errors were encountered: