diff --git a/cmd/minikube/cmd/root.go b/cmd/minikube/cmd/root.go index b4c03ebd75..bf36b5b305 100644 --- a/cmd/minikube/cmd/root.go +++ b/cmd/minikube/cmd/root.go @@ -18,8 +18,10 @@ package cmd import ( goflag "flag" + "io/ioutil" "os" + "github.com/docker/machine/libmachine/log" "github.com/golang/glog" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -31,6 +33,10 @@ var dirs = [...]string{ constants.MakeMiniPath("certs"), constants.MakeMiniPath("machines")} +var ( + showLibmachineLogs bool +) + // RootCmd represents the base command when called without any subcommands var RootCmd = &cobra.Command{ Use: "minikube", @@ -42,6 +48,11 @@ var RootCmd = &cobra.Command{ glog.Exitf("Error creating minikube directory: %s", err) } } + + if !showLibmachineLogs { + log.SetOutWriter(ioutil.Discard) + log.SetErrWriter(ioutil.Discard) + } }, } @@ -54,6 +65,7 @@ func Execute() { } func init() { + RootCmd.PersistentFlags().BoolVarP(&showLibmachineLogs, "show-libmachine-logs", "", false, "Whether or not to show logs from libmachine.") pflag.CommandLine.AddGoFlagSet(goflag.CommandLine) cobra.OnInitialize(initConfig) }