mirror of
https://github.com/spf13/cobra
synced 2025-04-27 09:07:19 +00:00
print aliases
This commit is contained in:
parent
ceb39aba25
commit
d4cc366cdb
1 changed files with 10 additions and 0 deletions
|
@ -29,6 +29,16 @@ import (
|
||||||
|
|
||||||
const markdownExtension = ".md"
|
const markdownExtension = ".md"
|
||||||
|
|
||||||
|
func printAliases(buf *bytes.Buffer, cmd *cobra.Command) {
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
|
func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
|
||||||
flags := cmd.NonInheritedFlags()
|
flags := cmd.NonInheritedFlags()
|
||||||
flags.SetOutput(buf)
|
flags.SetOutput(buf)
|
||||||
|
|
Loading…
Add table
Reference in a new issue