mirror of
https://github.com/spf13/cobra
synced 2024-11-16 18:57:08 +00:00
Persistent flags should also be used in completions
This commit is contained in:
parent
2e6a428921
commit
8fc369c700
1 changed files with 6 additions and 0 deletions
|
@ -305,6 +305,12 @@ func writeFlags(cmd *Command, out *bytes.Buffer) {
|
||||||
writeShortFlag(flag, out)
|
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")
|
fmt.Fprintf(out, "\n")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue