From 147bcc594a6dac287220857ce9e60ca4cc5d72ab Mon Sep 17 00:00:00 2001 From: Preslav Date: Mon, 25 Sep 2023 18:46:58 +0300 Subject: [PATCH] remove cobra.ExactArgs, verify manually there's at least 1 arg if no file or url. --- apps/cnquery/cmd/providers.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/cnquery/cmd/providers.go b/apps/cnquery/cmd/providers.go index 48ced9d5b0..399dc0796b 100644 --- a/apps/cnquery/cmd/providers.go +++ b/apps/cnquery/cmd/providers.go @@ -49,9 +49,8 @@ var listProvidersCmd = &cobra.Command{ } var installProviderCmd = &cobra.Command{ - Use: "install ", + Use: "install ", Short: "Install or update a provider.", - Args: cobra.ExactArgs(1), Long: "", PreRun: func(cmd *cobra.Command, args []string) {}, Run: func(cmd *cobra.Command, args []string) { @@ -69,6 +68,10 @@ var installProviderCmd = &cobra.Command{ return } + if len(args) == 0 { + log.Fatal().Msg("no provider specified, use the NAME[@VERSION] format to pass in a provider name") + } + // if no url or file is specified, we default to installing by name from the default upstream installProviderByName(args[0]) },