From 696da7ac87a2c092d11ca69136c704a1b6714a3c Mon Sep 17 00:00:00 2001 From: Guy Hadad Date: Sun, 4 Aug 2024 12:46:22 +0000 Subject: [PATCH] Removing unnecessary usage printing on errors which are not related --- tools/mconnect/commands/export/export.go | 3 +++ tools/mconnect/commands/groups/groups.go | 3 +++ tools/mconnect/commands/views/views.go | 3 +++ 3 files changed, 9 insertions(+) diff --git a/tools/mconnect/commands/export/export.go b/tools/mconnect/commands/export/export.go index ffbea4a..7de652c 100644 --- a/tools/mconnect/commands/export/export.go +++ b/tools/mconnect/commands/export/export.go @@ -239,6 +239,9 @@ By default it will be assumed that the project and region used for Migration Cen return messages.NoArgumentsAcceptedError{Args: args}.Error() } + // Remove usage printing on error once initial parameter validations are done. + cmd.SilenceUsage = true + if datasetID == "" { datasetID = defaultDatasetID } diff --git a/tools/mconnect/commands/groups/groups.go b/tools/mconnect/commands/groups/groups.go index e35e3af..bfad057 100644 --- a/tools/mconnect/commands/groups/groups.go +++ b/tools/mconnect/commands/groups/groups.go @@ -183,6 +183,9 @@ func NewCreateGroupsCmd(factory groupCreatorFactory) *cobra.Command { return messages.NoArgumentsAcceptedError{Args: args}.Error() } + // Remove usage printing on error once initial parameter validations are done. + cmd.SilenceUsage = true + fmt.Println(messages.ParsingFile{FilePath: path}) groups, err := parser.Groups(path) if err != nil { diff --git a/tools/mconnect/commands/views/views.go b/tools/mconnect/commands/views/views.go index d1bfcdd..b228f08 100644 --- a/tools/mconnect/commands/views/views.go +++ b/tools/mconnect/commands/views/views.go @@ -137,6 +137,9 @@ mconnect create-views --project=my-project-id --dataset=dataset-id --force=true` return messages.NoArgumentsAcceptedError{Args: args}.Error() } + // Remove usage printing on error once initial parameter validations are done. + cmd.SilenceUsage = true + vc := factory.build(projectID, datasetID) viewsMetadata := []viewMetadata{ newViewMetadata(mcViewName, "mc view description", mcQuery(projectID, datasetID)),