mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 21:21:14 +00:00
command lines: always show flags with hyphens
All Kubernetes commands should show flags with hyphens in their help text even when the flag originally was defined with underscore. Converting a command to this style is not breaking its command line API because the old-style parameter with underscore is accepted as alias. The easiest solution to achieve this is to set normalization shortly before running the command in the new central cli.Run or the few places where that function isn't used yet. There may be some texts which depends on normalization at flag definition time, like the --logging-format usage warning. Those get generated assuming that hyphens will be used.
This commit is contained in:
@@ -23,10 +23,7 @@ package main
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"k8s.io/component-base/cli"
|
||||
cliflag "k8s.io/component-base/cli/flag"
|
||||
_ "k8s.io/component-base/logs/json/register" // for JSON log format registration
|
||||
_ "k8s.io/component-base/metrics/prometheus/clientgo" // load all the prometheus client-go plugin
|
||||
_ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration
|
||||
@@ -34,8 +31,6 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
|
||||
|
||||
command := app.NewControllerManagerCommand()
|
||||
code := cli.Run(command)
|
||||
os.Exit(code)
|
||||
|
Reference in New Issue
Block a user