Skip to content

Commit

Permalink
DXCDT-311: Editorializing "hints" (#570)
Browse files Browse the repository at this point in the history
* First pass at hints

* Adding hint for login for multiple tenants

* Update internal/cli/login.go

Co-authored-by: Sergiu Ghitea <[email protected]>

* Upper-casing hint text

Co-authored-by: Will Vedder <[email protected]>
Co-authored-by: Sergiu Ghitea <[email protected]>
  • Loading branch information
3 people authored Dec 21, 2022
1 parent ec980ad commit 5d1ae61
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion internal/cli/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/email_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions internal/cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tenant>`",
ansi.Faint("Hint:"),
)
}

return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/prompts_custom_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"),
)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/quickstarts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"))
}
3 changes: 2 additions & 1 deletion internal/cli/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ auth0 test login <client-id> --connection <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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/universal_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"))
}
4 changes: 2 additions & 2 deletions internal/display/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand Down
4 changes: 2 additions & 2 deletions internal/display/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"),
)
}
Expand Down

0 comments on commit 5d1ae61

Please sign in to comment.