mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Persistent flags should also be used in completions
This commit is contained in:
parent
5c3dc12a87
commit
dab963a797
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