mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
add usage message only when parsing flags failed
This commit is contained in:
parent
9ff99adc60
commit
77c1949326
@ -49,6 +49,12 @@ func runSchedulerCmd() error {
|
||||
logs.InitLogs()
|
||||
defer logs.FlushLogs()
|
||||
|
||||
err := command.ParseFlags(os.Args[1:])
|
||||
if err != nil {
|
||||
// when fail to parse flags, return error with the usage message.
|
||||
return fmt.Errorf("%v\n%s", err, command.UsageString())
|
||||
}
|
||||
|
||||
if err := command.Execute(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user