From 2420bb1f3a3e5327a13ac017a3d355425e21850a Mon Sep 17 00:00:00 2001 From: Vincent Link Date: Fri, 27 Mar 2020 21:06:22 +0100 Subject: [PATCH] Show all global flags in cli options help Before this fix the flags shown in `minikube options` were taken from a list of options (`viperWhiteList`) which seems arbitrary. I still don't know for sure why this is done but taking all PersistentFlags (persistent=apply to all sub commands) from the root command seems like the correct way. --- cmd/minikube/cmd/options.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/minikube/cmd/options.go b/cmd/minikube/cmd/options.go index cc07420d6c..80f97606d1 100644 --- a/cmd/minikube/cmd/options.go +++ b/cmd/minikube/cmd/options.go @@ -37,10 +37,9 @@ var optionsCmd = &cobra.Command{ // runOptions handles the executes the flow of "minikube options" func runOptions(cmd *cobra.Command, args []string) { out.String("The following options can be passed to any command:\n\n") - for _, flagName := range viperWhiteList { - f := pflag.Lookup(flagName) - out.String(flagUsage(f)) - } + cmd.Root().PersistentFlags().VisitAll(func(flag *pflag.Flag) { + out.String(flagUsage(flag)) + }) } func flagUsage(flag *pflag.Flag) string {