From 000995e37c0c856894a44b7d2eddb129f3650b93 Mon Sep 17 00:00:00 2001 From: Alexis Kulash Date: Mon, 25 Jan 2021 16:09:03 -0500 Subject: [PATCH] Add spinner and massage command help message --- internal/cli/rules.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/cli/rules.go b/internal/cli/rules.go index 0d4e9ff93..0cf70aa27 100644 --- a/internal/cli/rules.go +++ b/internal/cli/rules.go @@ -1,6 +1,7 @@ package cli import ( + "github.com/auth0/auth0-cli/internal/ansi" "github.com/spf13/cobra" "gopkg.in/auth0.v5/management" ) @@ -49,10 +50,15 @@ func createRulesCmd(cli *cli) *cobra.Command { order int enabled bool } + cmd := &cobra.Command{ Use: "create", Short: "Create a new rule", - Long: "Create a new rule in your current tenant.", + Long: `Create a new rule: + + auth0 rules create --name "My Rule" --script "function (user, context, callback) { console.log( 'Hello, world!' ); return callback(null, user, context); }" + `, + Args: cobra.MinimumNArgs(2), RunE: func(cmd *cobra.Command, args []string) error { r := &management.Rule{ Name: &flags.name, @@ -61,7 +67,9 @@ func createRulesCmd(cli *cli) *cobra.Command { Enabled: &flags.enabled, } - err := cli.api.Client.Rule.Create(r) + err := ansi.Spinner("Creating rule", func() error { + return cli.api.Client.Rule.Create(r) + }) if err != nil { return err