Show inherited flags in help output
This commit is contained in:
parent
9c75cff94b
commit
ce59deb7b3
1 changed files with 5 additions and 0 deletions
|
|
@ -95,6 +95,11 @@ func rootHelpFunc(command *cobra.Command, args []string) {
|
|||
dedent := regexp.MustCompile(`(?m)^ `)
|
||||
helpEntries = append(helpEntries, helpEntry{"FLAGS", dedent.ReplaceAllString(flagUsages, "")})
|
||||
}
|
||||
inheritedFlagUsages := command.InheritedFlags().FlagUsages()
|
||||
if inheritedFlagUsages != "" {
|
||||
dedent := regexp.MustCompile(`(?m)^ `)
|
||||
helpEntries = append(helpEntries, helpEntry{"INHERITED FLAGS", dedent.ReplaceAllString(inheritedFlagUsages, "")})
|
||||
}
|
||||
if _, ok := command.Annotations["help:arguments"]; ok {
|
||||
helpEntries = append(helpEntries, helpEntry{"ARGUMENTS", command.Annotations["help:arguments"]})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue