Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2/4] DXCDT-266: Bring branding emails command under email templates #540

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions internal/cli/branding.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func brandingCmd(cli *cli) *cobra.Command {
cmd.AddCommand(showBrandingCmd(cli))
cmd.AddCommand(updateBrandingCmd(cli))
cmd.AddCommand(templateCmd(cli))
cmd.AddCommand(emailTemplateCmd(cli))
cmd.AddCommand(textsCmd(cli))

return cmd
}

Expand Down Expand Up @@ -117,19 +117,6 @@ Once you close the window, you’ll be asked if you want to save the template. I
return cmd
}

func emailTemplateCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "emails",
Short: "Manage custom email templates",
Long: "Manage custom email templates. This requires a custom email provider to be configured for the tenant.",
}

cmd.SetUsageTemplate(resourceUsageTemplate())
cmd.AddCommand(showEmailTemplateCmd(cli))
cmd.AddCommand(updateEmailTemplateCmd(cli))
return cmd
}

func showBrandingCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "show",
Expand Down
17 changes: 17 additions & 0 deletions internal/cli/email.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cli

import (
"github.com/spf13/cobra"
)

func emailCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "email",
Short: "Manage email settings",
Long: "Manage email settings.",
}

cmd.AddCommand(emailTemplateCmd(cli))

return cmd
}
21 changes: 17 additions & 4 deletions internal/cli/email_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ var (
}
)

func emailTemplateCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "templates",
Short: "Manage custom email templates",
Long: "Manage custom email templates. This requires a custom email provider to be configured for the tenant.",
}

cmd.SetUsageTemplate(resourceUsageTemplate())
cmd.AddCommand(showEmailTemplateCmd(cli))
cmd.AddCommand(updateEmailTemplateCmd(cli))
return cmd
}

func showEmailTemplateCmd(cli *cli) *cobra.Command {
var inputs struct {
Template string
Expand All @@ -106,8 +119,8 @@ func showEmailTemplateCmd(cli *cli) *cobra.Command {
Args: cobra.MaximumNArgs(1),
Short: "Show an email template",
Long: "Show an email template.",
Example: `auth0 branding emails show <template>
auth0 branding emails show welcome`,
Example: `auth0 email templates show <template>
auth0 email templates show welcome`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
err := emailTemplateTemplate.Pick(cmd, &inputs.Template, cli.emailTemplatePickerOptions)
Expand Down Expand Up @@ -152,8 +165,8 @@ func updateEmailTemplateCmd(cli *cli) *cobra.Command {
Args: cobra.MaximumNArgs(1),
Short: "Update an email template",
Long: "Update an email template.",
Example: `auth0 branding emails update <template>
auth0 branding emails update welcome`,
Example: `auth0 email templates update <template>
auth0 email templates update welcome`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
inputs.Template = args[0]
Expand Down
1 change: 1 addition & 0 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func addSubcommands(rootCmd *cobra.Command, cli *cli) {
rootCmd.AddCommand(rolesCmd(cli))
rootCmd.AddCommand(organizationsCmd(cli))
rootCmd.AddCommand(brandingCmd(cli))
rootCmd.AddCommand(emailCmd(cli))
rootCmd.AddCommand(customDomainsCmd(cli))
rootCmd.AddCommand(ipsCmd(cli))
rootCmd.AddCommand(quickstartsCmd(cli))
Expand Down