diff --git a/internal/cli/branding_texts.go b/internal/cli/prompts_custom_text.go similarity index 84% rename from internal/cli/branding_texts.go rename to internal/cli/prompts_custom_text.go index 46f939e84..5ab2a5f25 100644 --- a/internal/cli/branding_texts.go +++ b/internal/cli/prompts_custom_text.go @@ -37,38 +37,40 @@ var ( } ) -type brandingTextsInputs struct { +type promptsTextInput struct { Prompt string Language string Body string } -func textsCmd(cli *cli) *cobra.Command { +func universalLoginPromptsTextCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ - Use: "texts", - Short: "Manage custom text for prompts", - Long: "Manage custom text for prompts.", + Use: "prompts", + Short: "Manage custom text for prompts", + Long: fmt.Sprintf("Manage custom [text for prompts](%s).", textDocsURL), + Aliases: []string{"texts"}, } cmd.SetUsageTemplate(resourceUsageTemplate()) - cmd.AddCommand(showBrandingTextCmd(cli)) - cmd.AddCommand(updateBrandingTextCmd(cli)) + + cmd.AddCommand(showPromptsTextCmd(cli)) + cmd.AddCommand(updatePromptsTextCmd(cli)) return cmd } -func showBrandingTextCmd(cli *cli) *cobra.Command { - var inputs brandingTextsInputs +func showPromptsTextCmd(cli *cli) *cobra.Command { + var inputs promptsTextInput cmd := &cobra.Command{ Use: "show", Args: cobra.ExactArgs(1), - Short: "Show the custom texts for a prompt", - Long: "Show the custom texts for a prompt.", + Short: "Show the custom text for a prompt", + Long: "Show the custom text for a prompt.", Example: ` -auth0 branding texts show --language es -auth0 branding texts show -l es`, - RunE: showBrandingTexts(cli, &inputs), +auth0 universal-login prompts show --language es +auth0 universal-login prompts show -l es`, + RunE: showPromptsText(cli, &inputs), } textLanguage.RegisterString(cmd, &inputs.Language, textLanguageDefault) @@ -76,17 +78,17 @@ auth0 branding texts show -l es`, return cmd } -func updateBrandingTextCmd(cli *cli) *cobra.Command { - var inputs brandingTextsInputs +func updatePromptsTextCmd(cli *cli) *cobra.Command { + var inputs promptsTextInput cmd := &cobra.Command{ Use: "update", Args: cobra.ExactArgs(1), - Short: "Update the custom texts for a prompt", - Long: "Update the custom texts for a prompt.", + Short: "Update the custom text for a prompt", + Long: "Update the custom text for a prompt.", Example: ` -auth0 branding texts update --language es -auth0 branding texts update -l es`, +auth0 universal-login prompts update --language es +auth0 universal-login prompts update -l es`, RunE: updateBrandingText(cli, &inputs), } @@ -95,7 +97,7 @@ auth0 branding texts update -l es`, return cmd } -func showBrandingTexts(cli *cli, inputs *brandingTextsInputs) func(cmd *cobra.Command, args []string) error { +func showPromptsText(cli *cli, inputs *promptsTextInput) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { inputs.Prompt = args[0] brandingText := make(map[string]interface{}) @@ -123,7 +125,7 @@ func showBrandingTexts(cli *cli, inputs *brandingTextsInputs) func(cmd *cobra.Co } } -func updateBrandingText(cli *cli, inputs *brandingTextsInputs) func(cmd *cobra.Command, args []string) error { +func updateBrandingText(cli *cli, inputs *promptsTextInput) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { inputs.Prompt = args[0] inputs.Body = string(iostream.PipedInput()) @@ -160,7 +162,7 @@ func updateBrandingText(cli *cli, inputs *brandingTextsInputs) func(cmd *cobra.C } } -func fetchBrandingTextContentToEdit(cli *cli, inputs *brandingTextsInputs) (string, error) { +func fetchBrandingTextContentToEdit(cli *cli, inputs *promptsTextInput) (string, error) { contentToEdit := map[string]interface{}{textDocsKey: textDocsURL} if err := ansi.Waiting(func() error { @@ -276,7 +278,7 @@ func mergeBrandingTextTranslations( func fetchEditedBrandingTextContent( cmd *cobra.Command, cli *cli, - inputs *brandingTextsInputs, + inputs *promptsTextInput, brandingTextToEdit string, ) (map[string]interface{}, error) { tempFileName := fmt.Sprintf("%s-prompt-%s.json", inputs.Prompt, inputs.Language) diff --git a/internal/cli/branding_texts_test.go b/internal/cli/prompts_custom_text_test.go similarity index 98% rename from internal/cli/branding_texts_test.go rename to internal/cli/prompts_custom_text_test.go index 6b92c2845..7e3734df4 100644 --- a/internal/cli/branding_texts_test.go +++ b/internal/cli/prompts_custom_text_test.go @@ -68,7 +68,7 @@ func TestBrandingTextsShowCmd(t *testing.T) { api: &auth0.API{Prompt: brandingTextsAPI}, } - cmd := showBrandingTextCmd(cli) + cmd := showPromptsTextCmd(cli) cmd.SetArgs([]string{test.inputPrompt, "--language=" + test.inputLanguage}) err := cmd.Execute() diff --git a/internal/cli/root.go b/internal/cli/root.go index 6191a0085..10c7c013c 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -176,7 +176,7 @@ func addSubcommands(rootCmd *cobra.Command, cli *cli) { rootCmd.AddCommand(apisCmd(cli)) rootCmd.AddCommand(rolesCmd(cli)) rootCmd.AddCommand(organizationsCmd(cli)) - rootCmd.AddCommand(brandingCmd(cli)) + rootCmd.AddCommand(universalLoginCmd(cli)) rootCmd.AddCommand(emailCmd(cli)) rootCmd.AddCommand(customDomainsCmd(cli)) rootCmd.AddCommand(ipsCmd(cli)) diff --git a/internal/cli/branding.go b/internal/cli/universal_login.go similarity index 91% rename from internal/cli/branding.go rename to internal/cli/universal_login.go index 5010123be..10a30706a 100644 --- a/internal/cli/branding.go +++ b/internal/cli/universal_login.go @@ -73,26 +73,28 @@ var ( errNotAllowed = errors.New("this feature requires at least one custom domain to be configured for the tenant") ) -func brandingCmd(cli *cli) *cobra.Command { +func universalLoginCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ - Use: "branding", - Short: "Manage branding options", - Long: "Manage branding options.", + Use: "universal-login", + Short: "Manage the Universal Login experience", + Long: "Manage a consistent, branded Universal Login experience that can handle all of your authentication flows.", + Aliases: []string{"ul"}, } cmd.SetUsageTemplate(resourceUsageTemplate()) - cmd.AddCommand(showBrandingCmd(cli)) - cmd.AddCommand(updateBrandingCmd(cli)) - cmd.AddCommand(templateCmd(cli)) - cmd.AddCommand(textsCmd(cli)) + + cmd.AddCommand(showUniversalLoginCmd(cli)) + cmd.AddCommand(updateUniversalLoginCmd(cli)) + cmd.AddCommand(universalLoginTemplatesCmd(cli)) + cmd.AddCommand(universalLoginPromptsTextCmd(cli)) return cmd } -func templateCmd(cli *cli) *cobra.Command { +func universalLoginTemplatesCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ Use: "templates", - Short: "Manage custom page templates", + Short: "Manage custom Universal Login templates", Long: `Manage custom [page templates](https://auth0.com/docs/universal-login/new-experience/universal-login-page-templates). This requires a custom domain to be configured for the tenant. This command will open two windows: @@ -117,13 +119,13 @@ Once you close the window, you’ll be asked if you want to save the template. I return cmd } -func showBrandingCmd(cli *cli) *cobra.Command { +func showUniversalLoginCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ Use: "show", Args: cobra.NoArgs, Short: "Display the custom branding settings for Universal Login", Long: "Display the custom branding settings for Universal Login.", - Example: "auth0 branding show", + Example: "auth0 universal-login show", RunE: func(cmd *cobra.Command, args []string) error { var myBranding *management.Branding // Load app by id @@ -144,7 +146,7 @@ func showBrandingCmd(cli *cli) *cobra.Command { return cmd } -func updateBrandingCmd(cli *cli) *cobra.Command { +func updateUniversalLoginCmd(cli *cli) *cobra.Command { var inputs struct { AccentColor string BackgroundColor string @@ -158,9 +160,9 @@ func updateBrandingCmd(cli *cli) *cobra.Command { Args: cobra.NoArgs, Short: "Update the custom branding settings for Universal Login", Long: "Update the custom branding settings for Universal Login.", - Example: `auth0 branding update -auth0 branding update --accent "#FF4F40" --background "#2A2E35" -auth0 branding update -a "#FF4F40" -b "#2A2E35" --logo "https://example.com/logo.png"`, + Example: `auth0 universal-login update +auth0 universal-login update --accent "#FF4F40" --background "#2A2E35" +auth0 universal-login update -a "#FF4F40" -b "#2A2E35" --logo "https://example.com/logo.png"`, RunE: func(cmd *cobra.Command, args []string) error { var current *management.Branding @@ -258,7 +260,7 @@ func showBrandingTemplateCmd(cli *cli) *cobra.Command { Args: cobra.NoArgs, Short: "Display the custom template for Universal Login", Long: "Display the custom template for Universal Login.", - Example: "auth0 branding templates show", + Example: "auth0 universal-login templates show", RunE: func(cmd *cobra.Command, args []string) error { var template *management.BrandingUniversalLogin // Load app by id @@ -286,7 +288,7 @@ func updateBrandingTemplateCmd(cli *cli) *cobra.Command { Args: cobra.NoArgs, Short: "Update the custom template for Universal Login", Long: "Update the custom template for Universal Login.", - Example: "auth0 branding templates update", + Example: "auth0 universal-login templates update", RunE: func(cmd *cobra.Command, args []string) error { var templateData *branding.TemplateData err := ansi.Waiting(func() error {