-
Notifications
You must be signed in to change notification settings - Fork 3k
Print command aliases in docs, not as a section #2271
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
base: main
Are you sure you want to change the base?
Conversation
Is this a WIP PR? Unless I'm wrong, nothing calls this new method. So what is expected here? |
doc/md_docs.go
Outdated
if len(cmd.Aliases) > 0 { | ||
buf.WriteString("### Aliases\n\n") | ||
for _, alias := range cmd.Aliases { | ||
buf.WriteString(fmt.Sprintf("* `%s`\n", alias)) | ||
} | ||
buf.WriteString("\n") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎨 this is a pure stylistic feedbacks.
It's open for debate.
Maybe the rendering could be different when there is only one alias.
Because this might seem empty as a section
### Aliases
* foobar
So, here maybe another rendering could be considered.
When multiple aliases are available
Aliases: foobar, fooquz
And when there is only one
Aliases: foobar
Please note, I didn't use a section on purpose
Yes, I am still changing it. Sorry, I should've specified that earlier. |
Ok, I am done with changing it. |
Co-authored-by: ccoVeille <[email protected]>
doc/md_docs.go
Outdated
if i > 0 { | ||
buf.WriteString(", ") | ||
} | ||
buf.WriteString(fmt.Sprintf("`%s`", alias)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I'm surprised by this syntax, that was already used in the file I concede
I feel like this would be more natural.
Note
This is more a note to myself to look deeper than something I expect you to change
This could have been used
buf.WriteString(fmt.Sprintf("`%s`", alias)) | |
fmt.Fprintf(buf, "`%s`", alias) |
@commit111 please look at this that seems a better option
Co-authored-by: ccoVeille <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR changes
GenMarkdownCustom()
indoc/md_docs.go
so it can print the list of Aliases of a command in the markdown of docs.Related to #2223, but the difference is that this PR does not print it as a separate section.