-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[Docs]: Please include trivial example for use of Format String #17676
Comments
Related: #17472 |
Interested in opening a PR with this change? We have examples in these man pages correct? |
Yes AFAIK we have examples at the bottom on most pages and also --help, but I agree that some docs actually describing how templates work would help, possibly just linking to the go docs, https://pkg.go.dev/text/template Also FYI you use shell completion in templates to retrieve the names:
|
Thanks, yeah, only after opening this I saw it staring me in the face when I did Also interesting on the tab-completion. Although I'm on fish/nushell and don't get this (or any other tab completions usually, they tend to do more harm than good I find!) on either of those. Conceptually happy to open a PR, except I'm super busy at the moment and am not really finding time ot follow up on anything am afraid ;) |
Tab completion should work on bash, zsh, fish and powershell assuming you have loaded the completion scripts, we use https://github.com/spf13/cobra to generate them. I tried it with fish and it seems to escape the closing brackets so it is not fully usable but still show the names:
So this is likely something that we should report to the cobra project. |
I wasn't getting anything but files in the PWD, but possibly my fish is not set up properly or a bit old. So I think that is a good idea. |
The completion only triggers with |
Yes I excluded |
A friendly reminder that this issue had no activity for 30 days. |
We believe this works in the current code base, closing. reopen if I am mistaken. |
Feature request description
Please could the man pages for commands that include a format option include a very brief example of how these templates work? A single one-line "e.g. --format='{{.Name}}:{{.Tag}}'" in this section of the manual would do IMO. Options discussed below.
Not being a go user, the format
{{.Tag}}
is not obvious to me (looking like a half mix of JSON and liquid tags and with LeadingCamelCase - so a few things that I wouldn;t try off the top of my head all together), and as I have a really large graphroot on this machine, I wasted some amount of time sitting waiting for it to run, only having the string '.Tag' printed out to me many times!Suggest potential solution
Options:
Man page sections on format flags:
Have you considered any alternatives?
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: