From 4d9f1a000214f1f9d6a05b89b061f40f8408dbc2 Mon Sep 17 00:00:00 2001 From: Manabu McCloskey Date: Fri, 22 Nov 2024 07:40:50 -0800 Subject: [PATCH] prevent printing usages on error (#457) Signed-off-by: Manabu McCloskey --- pkg/cmd/create/root.go | 11 ++++++----- pkg/cmd/delete/root.go | 11 ++++++----- pkg/cmd/get/clusters.go | 11 ++++++----- pkg/cmd/get/secrets.go | 9 +++++---- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/pkg/cmd/create/root.go b/pkg/cmd/create/root.go index 1e2ff4b9..62d6a943 100644 --- a/pkg/cmd/create/root.go +++ b/pkg/cmd/create/root.go @@ -55,11 +55,12 @@ var ( ) var CreateCmd = &cobra.Command{ - Use: "create", - Short: "(Re)Create an IDP cluster", - Long: ``, - RunE: create, - PreRunE: preCreateE, + Use: "create", + Short: "(Re)Create an IDP cluster", + Long: ``, + RunE: create, + PreRunE: preCreateE, + SilenceUsage: true, } func init() { diff --git a/pkg/cmd/delete/root.go b/pkg/cmd/delete/root.go index 953a8420..d922290c 100644 --- a/pkg/cmd/delete/root.go +++ b/pkg/cmd/delete/root.go @@ -16,11 +16,12 @@ var ( ) var DeleteCmd = &cobra.Command{ - Use: "delete", - Short: "Delete an IDP cluster", - Long: ``, - RunE: deleteE, - PreRunE: preDeleteE, + Use: "delete", + Short: "Delete an IDP cluster", + Long: ``, + RunE: deleteE, + PreRunE: preDeleteE, + SilenceUsage: true, } func init() { diff --git a/pkg/cmd/get/clusters.go b/pkg/cmd/get/clusters.go index 01708c8d..ba261f9d 100644 --- a/pkg/cmd/get/clusters.go +++ b/pkg/cmd/get/clusters.go @@ -9,11 +9,12 @@ import ( ) var ClustersCmd = &cobra.Command{ - Use: "clusters", - Short: "Get idp clusters", - Long: ``, - RunE: list, - PreRunE: preClustersE, + Use: "clusters", + Short: "Get idp clusters", + Long: ``, + RunE: list, + PreRunE: preClustersE, + SilenceUsage: true, } func preClustersE(cmd *cobra.Command, args []string) error { diff --git a/pkg/cmd/get/secrets.go b/pkg/cmd/get/secrets.go index 5cad39c3..607c0870 100644 --- a/pkg/cmd/get/secrets.go +++ b/pkg/cmd/get/secrets.go @@ -35,10 +35,11 @@ const ( var templates embed.FS var SecretsCmd = &cobra.Command{ - Use: "secrets", - Short: "retrieve secrets from the cluster", - Long: ``, - RunE: getSecretsE, + Use: "secrets", + Short: "retrieve secrets from the cluster", + Long: ``, + RunE: getSecretsE, + SilenceUsage: true, } // well known secrets that are part of the core packages