Persistent flags should also be used in completions

This commit is contained in:
Fabiano Franz 2015-11-04 14:40:11 -05:00 committed by spf13
parent 5c3dc12a87
commit dab963a797
1 changed files with 6 additions and 0 deletions

View File

@ -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")
}