Skip to content

Commit cf9020b

Browse files
astefanuttiopenshift-merge-robot
authored andcommitted
fix duplicated kubeconfig CLI option
1 parent a4ce80c commit cf9020b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,16 @@ func main() {
7878
TimeEncoder: zapcore.TimeEncoderOfLayout(time.RFC3339),
7979
}
8080

81-
flagSet := flag.CommandLine
81+
flagSet := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
82+
flag.CommandLine.VisitAll(func(f *flag.Flag) {
83+
if f.Name != "kubeconfig" {
84+
flagSet.Var(f.Value, f.Name, f.Usage)
85+
}
86+
})
87+
8288
zapOptions.BindFlags(flagSet)
8389
mcadOptions.AddFlags(flagSet)
84-
flag.Parse()
90+
_ = flagSet.Parse(os.Args[1:])
8591

8692
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&zapOptions)))
8793

0 commit comments

Comments
 (0)