mirror of https://github.com/spf13/cobra.git
Persistent flags should also be used in completions
This commit is contained in:
parent
5c3dc12a87
commit
dab963a797
|
@ -305,6 +305,12 @@ func writeFlags(cmd *Command, out *bytes.Buffer) {
|
|||
writeShortFlag(flag, out)
|
||||
}
|
||||
})
|
||||
cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
|
||||
writeFlag(flag, out)
|
||||
if len(flag.Shorthand) > 0 {
|
||||
writeShortFlag(flag, out)
|
||||
}
|
||||
})
|
||||
|
||||
fmt.Fprintf(out, "\n")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue