From d3843a7aec6e05eedb4fe042d54cded604410a38 Mon Sep 17 00:00:00 2001 From: Michael Mraka Date: Mon, 7 Aug 2023 13:43:42 +0200 Subject: [PATCH] add -q to suppress logging --- gabi-cli.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gabi-cli.go b/gabi-cli.go index 7286cfd..587d2a6 100644 --- a/gabi-cli.go +++ b/gabi-cli.go @@ -7,6 +7,7 @@ import ( "flag" "fmt" "io" + "io/ioutil" "log" "net/http" "os" @@ -36,6 +37,7 @@ func main() { kubeconfigPath = flag.String("kubeconfig", "", "absolute path to the kubeconfig file") } showHelp := flag.Bool("h", false, "Shows help") + quiet := flag.Bool("q", false, "Suppress logging messages") namespace := flag.String("n", "", "Namespace (defaults to current context)") flag.Parse() @@ -44,6 +46,9 @@ func main() { os.Exit(1) } + if *quiet { + log.SetOutput(ioutil.Discard) + } kubeconfig, config := setupK8s(*kubeconfigPath) setDefaultNamespace(kubeconfig, namespace)