From 226ee0415133c23745d78ac3f839415000564df8 Mon Sep 17 00:00:00 2001 From: Dawid Pogorzelski Date: Sat, 3 Apr 2021 15:29:34 +0200 Subject: [PATCH] Suppress help on error (#46) --- cloud/google.go | 2 +- cmd/root.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cloud/google.go b/cloud/google.go index 6b7fe0f..0abfa2c 100644 --- a/cloud/google.go +++ b/cloud/google.go @@ -20,7 +20,7 @@ func NewComputeClient(project string) (*ComputeClient, error) { s, err := compute.NewService(ctx) if err != nil { - err = fmt.Errorf("Couldn't initialize GCP client (Compute): %v", err) + err = fmt.Errorf("couldn't initialize GCP client: %v", err) return nil, err } computeService := &ComputeClient{s, project} diff --git a/cmd/root.go b/cmd/root.go index 26594ab..65b6645 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -19,9 +19,11 @@ var date string func Execute() { // cobra.OnInitialize(initConfig) var rootCmd = &cobra.Command{ - Use: "speedrun", - Short: "Cloud first command execution", - Version: fmt.Sprintf("%s, commit: %s, date: %s", version, commit, date), + Use: "speedrun", + Short: "Cloud first command execution", + Version: fmt.Sprintf("%s, commit: %s, date: %s", version, commit, date), + SilenceUsage: true, + SilenceErrors: true, } rootCmd.AddCommand(initCmd)