mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #106172 from pohly/log-kubectl-options-deprecation
kubectl: add deprecation notice to flag usage help
This commit is contained in:
commit
2ee2b8cab0
@ -225,10 +225,10 @@ func flagsUsages(f *flag.FlagSet) string {
|
||||
if flag.Hidden {
|
||||
return
|
||||
}
|
||||
format := "--%s=%s: %s\n"
|
||||
format := "--%s=%s: %s%s\n"
|
||||
|
||||
if flag.Value.Type() == "string" {
|
||||
format = "--%s='%s': %s\n"
|
||||
format = "--%s='%s': %s%s\n"
|
||||
}
|
||||
|
||||
if len(flag.Shorthand) > 0 {
|
||||
@ -237,7 +237,12 @@ func flagsUsages(f *flag.FlagSet) string {
|
||||
format = " %s " + format
|
||||
}
|
||||
|
||||
fmt.Fprintf(x, format, flag.Shorthand, flag.Name, flag.DefValue, flag.Usage)
|
||||
deprecated := ""
|
||||
if flag.Deprecated != "" {
|
||||
deprecated = fmt.Sprintf(" (DEPRECATED: %s)", flag.Deprecated)
|
||||
}
|
||||
|
||||
fmt.Fprintf(x, format, flag.Shorthand, flag.Name, flag.DefValue, flag.Usage, deprecated)
|
||||
})
|
||||
|
||||
return x.String()
|
||||
|
Loading…
Reference in New Issue
Block a user