From c71ec32c6298bcbe707dc8bd28cc341ca9790965 Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:03:29 +0100 Subject: [PATCH] Add help text to api cmd when no args passed --- internal/cli/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/cli/api.go b/internal/cli/api.go index bce5efc11..94be6f987 100644 --- a/internal/cli/api.go +++ b/internal/cli/api.go @@ -72,7 +72,7 @@ func apiCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ Use: "api ", - Args: cobra.RangeArgs(1, 2), + Args: cobra.RangeArgs(0, 2), Short: "Makes an authenticated HTTP request to the Auth0 Management API", Long: fmt.Sprintf( `Makes an authenticated HTTP request to the [Auth0 Management API](%s) and returns the response as JSON. @@ -117,6 +117,10 @@ func apiUsageTemplate() string { func apiCmdRun(cli *cli, inputs *apiCmdInputs) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + return cmd.Help() + } + if err := inputs.fromArgs(args, cli.tenant); err != nil { return fmt.Errorf("failed to parse command inputs: %w", err) }