Skip to content

Commit

Permalink
remove cobra.ExactArgs, verify manually there's at least 1 arg if no …
Browse files Browse the repository at this point in the history
…file or url.
  • Loading branch information
preslavgerchev committed Sep 25, 2023
1 parent f58d36c commit 147bcc5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/cnquery/cmd/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ var listProvidersCmd = &cobra.Command{
}

var installProviderCmd = &cobra.Command{
Use: "install <NAME@[VERSION]>",
Use: "install <NAME[@VERSION]>",
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) {
Expand All @@ -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])
},
Expand Down

0 comments on commit 147bcc5

Please sign in to comment.