skip print section flags if no flags
Kubernetes-commit: 01195efbe3a2b7beefdf7308193818fd37790254
This commit is contained in:
parent
838b98e1f1
commit
eaef210960
|
|
@ -52,6 +52,9 @@ func (nfs *NamedFlagSets) FlagSet(name string) *pflag.FlagSet {
|
||||||
func PrintSections(w io.Writer, fss NamedFlagSets, cols int) {
|
func PrintSections(w io.Writer, fss NamedFlagSets, cols int) {
|
||||||
for _, name := range fss.Order {
|
for _, name := range fss.Order {
|
||||||
fs := fss.FlagSets[name]
|
fs := fss.FlagSets[name]
|
||||||
|
if !fs.HasFlags() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
wideFS := pflag.NewFlagSet("", pflag.ExitOnError)
|
wideFS := pflag.NewFlagSet("", pflag.ExitOnError)
|
||||||
wideFS.AddFlagSet(fs)
|
wideFS.AddFlagSet(fs)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue