From 5d1ae61f2ee742b5c9024b7bc85be91906b503e0 Mon Sep 17 00:00:00 2001 From: Will Vedder Date: Wed, 21 Dec 2022 10:31:45 -0500 Subject: [PATCH] DXCDT-311: Editorializing "hints" (#570) * First pass at hints * Adding hint for login for multiple tenants * Update internal/cli/login.go Co-authored-by: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> * Upper-casing hint text Co-authored-by: Will Vedder Co-authored-by: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> --- internal/cli/actions.go | 2 +- internal/cli/apps.go | 2 +- internal/cli/email_templates.go | 2 +- internal/cli/login.go | 6 ++++++ internal/cli/logs.go | 2 +- internal/cli/prompts_custom_text.go | 2 +- internal/cli/quickstarts.go | 2 +- internal/cli/rules.go | 2 +- internal/cli/test.go | 3 ++- internal/cli/universal_login.go | 2 +- internal/cli/users.go | 2 +- internal/display/apps.go | 4 ++-- internal/display/rules.go | 4 ++-- 13 files changed, 21 insertions(+), 14 deletions(-) diff --git a/internal/cli/actions.go b/internal/cli/actions.go index b9745e6e9..b8babc146 100644 --- a/internal/cli/actions.go +++ b/internal/cli/actions.go @@ -515,7 +515,7 @@ func (c *cli) actionPickerOptions() (pickerOptions, error) { } func (c *cli) actionEditorHint() { - c.renderer.Infof("%s once you close the editor, the action will be saved. To cancel, CTRL+C.", ansi.Faint("Hint:")) + c.renderer.Infof("%s Once you close the editor, the action will be saved. To cancel, press CTRL+C.", ansi.Faint("Hint:")) } func formatActionDetailsPath(id string) string { diff --git a/internal/cli/apps.go b/internal/cli/apps.go index 546beb37f..d191a6126 100644 --- a/internal/cli/apps.go +++ b/internal/cli/apps.go @@ -181,7 +181,7 @@ func useAppCmd(cli *cli) *cobra.Command { cli.renderer.Infof("Successfully removed the default application") } else { cli.renderer.Infof("Successfully set the default application to %s", ansi.Faint(inputs.ID)) - cli.renderer.Infof("%s You might wanna try 'auth0 quickstarts download %s'", ansi.Faint("Hint:"), inputs.ID) + cli.renderer.Infof("%s Consider running `auth0 quickstarts download %s`", ansi.Faint("Hint:"), inputs.ID) } return nil diff --git a/internal/cli/email_templates.go b/internal/cli/email_templates.go index 8db2acea6..3e01cdf2d 100644 --- a/internal/cli/email_templates.go +++ b/internal/cli/email_templates.go @@ -281,7 +281,7 @@ auth0 email templates update welcome`, } func (c *cli) emailTemplateEditorHint() { - c.renderer.Infof("%s once you close the editor, the email template will be saved. To cancel, CTRL+C.", ansi.Faint("Hint:")) + c.renderer.Infof("%s Once you close the editor, the email template will be saved. To cancel, press CTRL+C.", ansi.Faint("Hint:")) } func (c *cli) emailTemplatePickerOptions() (pickerOptions, error) { diff --git a/internal/cli/login.go b/internal/cli/login.go index adf9fe18c..31c27b716 100644 --- a/internal/cli/login.go +++ b/internal/cli/login.go @@ -122,6 +122,12 @@ auth0 login --scopes "read:client_grants,create:client_grants"`, cli.tracker.TrackCommandRun(cmd, cli.config.InstallID) + if len(cli.config.Tenants) > 1 { + cli.renderer.Infof("%s Switch between authenticated tenants with `auth0 tenants use `", + ansi.Faint("Hint:"), + ) + } + return nil }, } diff --git a/internal/cli/logs.go b/internal/cli/logs.go index 767e0ef2f..c4e120bd3 100644 --- a/internal/cli/logs.go +++ b/internal/cli/logs.go @@ -163,7 +163,7 @@ auth0 logs tail -n 100`, logsNum.RegisterInt(cmd, &inputs.Num, 100) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") - + return cmd } diff --git a/internal/cli/prompts_custom_text.go b/internal/cli/prompts_custom_text.go index 5ab2a5f25..df1f7040a 100644 --- a/internal/cli/prompts_custom_text.go +++ b/internal/cli/prompts_custom_text.go @@ -301,7 +301,7 @@ func fetchEditedBrandingTextContent( func updateBrandingTextHint(cli *cli) func() { return func() { cli.renderer.Infof( - "%s once you close the editor, the custom text will be saved. To cancel, CTRL+C.", + "%s Once you close the editor, the custom text will be saved. To cancel, press CTRL+C.", ansi.Faint("Hint:"), ) } diff --git a/internal/cli/quickstarts.go b/internal/cli/quickstarts.go index ad2ece8cf..1f052c2b0 100644 --- a/internal/cli/quickstarts.go +++ b/internal/cli/quickstarts.go @@ -174,7 +174,7 @@ func downloadQuickstart(cli *cli, inputs *qsInputs) func(cmd *cobra.Command, arg return err } - cli.renderer.Infof("%s Start with 'cd %s'", ansi.Faint("Hint:"), relativeQSSamplePath) + cli.renderer.Infof("%s Start with `cd %s`", ansi.Faint("Hint:"), relativeQSSamplePath) return nil } diff --git a/internal/cli/rules.go b/internal/cli/rules.go index b04e0ee63..1c0dc76af 100644 --- a/internal/cli/rules.go +++ b/internal/cli/rules.go @@ -516,5 +516,5 @@ func (c *cli) rulePickerOptions() (pickerOptions, error) { } func (c *cli) ruleEditorHint() { - c.renderer.Infof("%s once you close the editor, the rule will be saved. To cancel, CTRL+C.", ansi.Faint("Hint:")) + c.renderer.Infof("%s Once you close the editor, the rule will be saved. To cancel, press CTRL+C.", ansi.Faint("Hint:")) } diff --git a/internal/cli/test.go b/internal/cli/test.go index 38ce40bb4..7b1907110 100644 --- a/internal/cli/test.go +++ b/internal/cli/test.go @@ -183,7 +183,8 @@ auth0 test login --connection `, } if isFirstRun { - cli.renderer.Infof("%s Login flow is working! Next, try downloading and running a Quickstart: 'auth0 quickstarts download %s'", + cli.renderer.Infof("Login flow is working!") + cli.renderer.Infof("%s Consider downloading and running a quickstart next by running `auth0 quickstarts download %s`", ansi.Faint("Hint:"), inputs.ClientID) if err := cli.setFirstCommandRun(inputs.ClientID, commandKey); err != nil { diff --git a/internal/cli/universal_login.go b/internal/cli/universal_login.go index 272318bfb..0c0497953 100644 --- a/internal/cli/universal_login.go +++ b/internal/cli/universal_login.go @@ -353,7 +353,7 @@ func (cli *cli) customTemplateEditorPromptWithPreview(cmd *cobra.Command, body * defer cancel() onInfo := func() { - cli.renderer.Infof("%s once you close the editor, you'll be prompted to save your changes. To cancel, CTRL+C.", ansi.Faint("Hint:")) + cli.renderer.Infof("%s Once you close the editor, you'll be prompted to save your changes. To cancel, press CTRL+C.", ansi.Faint("Hint:")) } onFileCreated := func(filename string) { diff --git a/internal/cli/users.go b/internal/cli/users.go index 252162694..50978ccb1 100644 --- a/internal/cli/users.go +++ b/internal/cli/users.go @@ -731,5 +731,5 @@ func (c *cli) getConnReqUsername(s string) *bool { } func (c *cli) userImportEditorHint() { - c.renderer.Infof("%s once you close the editor, the user(s) will be imported. To cancel, CTRL+C.", ansi.Faint("Hint:")) + c.renderer.Infof("%s Once you close the editor, the user(s) will be imported. To cancel, CTRL+C.", ansi.Faint("Hint:")) } diff --git a/internal/display/apps.go b/internal/display/apps.go index f6745054d..e234e3c16 100644 --- a/internal/display/apps.go +++ b/internal/display/apps.go @@ -147,11 +147,11 @@ func (r *Renderer) ApplicationCreate(client *management.Client, revealSecrets bo r.Infof("Quickstarts: %s", quickstartsURIFor(client.GetAppType())) // TODO(cyx): possibly guard this with a --no-hint flag. - r.Infof("%s Test this app's login box with 'auth0 test login %s'", + r.Infof("%s Emulate this app's login flow by running `auth0 test login %s`", ansi.Faint("Hint:"), client.GetClientID(), ) - r.Infof("%s You might wanna try 'auth0 quickstarts download %s'", + r.Infof("%s Consider running `auth0 quickstarts download %s`", ansi.Faint("Hint:"), client.GetClientID(), ) diff --git a/internal/display/rules.go b/internal/display/rules.go index 362999a8e..5e051877d 100644 --- a/internal/display/rules.go +++ b/internal/display/rules.go @@ -73,12 +73,12 @@ func (r *Renderer) RuleCreate(rule *management.Rule) { r.Newline() // TODO(cyx): possibly guard this with a --no-hint flag. - r.Infof("%s To edit this rule, do 'auth0 rules update %s'", + r.Infof("%s To edit this rule, run `auth0 rules update %s`", ansi.Faint("Hint:"), rule.GetID(), ) - r.Infof("%s You might wanna try 'auth0 test login'", + r.Infof("%s Consider running `auth0 test login` to emulate the login flow", ansi.Faint("Hint:"), ) }