From af4ceb679fd1d5c45b7dce84b0f3ae25c13bde1f Mon Sep 17 00:00:00 2001 From: Benjamin Jee Date: Fri, 10 Nov 2023 11:40:54 -0800 Subject: [PATCH 1/2] Remove usage info from log output --- cmd/gateway/commands.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/gateway/commands.go b/cmd/gateway/commands.go index 9e02599c65..a76a859c9e 100644 --- a/cmd/gateway/commands.go +++ b/cmd/gateway/commands.go @@ -93,8 +93,9 @@ func createStaticModeCommand() *cobra.Command { ) cmd := &cobra.Command{ - Use: "static-mode", - Short: "Configure NGINX in the scope of a single Gateway resource", + Use: "static-mode", + Short: "Configure NGINX in the scope of a single Gateway resource", + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { atom := zap.NewAtomicLevel() From 4d6a7e753188c7760530f9607a9e32e74fa5995a Mon Sep 17 00:00:00 2001 From: Benjamin Jee Date: Fri, 10 Nov 2023 15:01:44 -0800 Subject: [PATCH 2/2] Add SilenceError and move changes to root cobra command --- cmd/gateway/commands.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/gateway/commands.go b/cmd/gateway/commands.go index a76a859c9e..f43cebbb40 100644 --- a/cmd/gateway/commands.go +++ b/cmd/gateway/commands.go @@ -30,7 +30,9 @@ const ( func createRootCommand() *cobra.Command { rootCmd := &cobra.Command{ - Use: "gateway", + Use: "gateway", + SilenceUsage: true, + SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { return cmd.Help() }, @@ -93,9 +95,8 @@ func createStaticModeCommand() *cobra.Command { ) cmd := &cobra.Command{ - Use: "static-mode", - Short: "Configure NGINX in the scope of a single Gateway resource", - SilenceUsage: true, + Use: "static-mode", + Short: "Configure NGINX in the scope of a single Gateway resource", RunE: func(cmd *cobra.Command, args []string) error { atom := zap.NewAtomicLevel()