Skip to content

Commit

Permalink
DXCDT-400: Allowing piped-in templates into `auth0 ul templates updat…
Browse files Browse the repository at this point in the history
…e` (#950)

Adding piped-in HTML and updated docs
  • Loading branch information
willvedd authored and Michael Christenson II committed Dec 21, 2023
1 parent 1526d5a commit 8f8b166
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/auth0_universal-login_templates_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ auth0 universal-login templates update [flags]
```
auth0 universal-login templates update
auth0 ul templates update
cat login.liquid | auth0 ul templates update
echo "<html>{%- auth0:head -%}{%- auth0:widget -%}</html>" | auth0 ul templates update
```


Expand Down
10 changes: 9 additions & 1 deletion internal/cli/universal_login_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/auth0/auth0-cli/internal/ansi"
"github.com/auth0/auth0-cli/internal/auth0"
"github.com/auth0/auth0-cli/internal/iostream"
"github.com/auth0/auth0-cli/internal/prompt"
)

Expand Down Expand Up @@ -136,7 +137,9 @@ func updateBrandingTemplateCmd(cli *cli) *cobra.Command {
Short: "Update the custom template for Universal Login",
Long: "Update the custom template for the New Universal Login Experience.",
Example: ` auth0 universal-login templates update
auth0 ul templates update`,
auth0 ul templates update
cat login.liquid | auth0 ul templates update
echo "<html>{%- auth0:head -%}{%- auth0:widget -%}</html>" | auth0 ul templates update`,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

Expand All @@ -161,6 +164,11 @@ func updateBrandingTemplateCmd(cli *cli) *cobra.Command {
templateData.Body = templateOptions.getValue(templateData.Body)
}

pipedTemplateHTML := iostream.PipedInput()
if len(pipedTemplateHTML) > 0 {
templateData.Body = string(pipedTemplateHTML)
}

if err := cli.editTemplateAndPreviewChanges(ctx, cmd, templateData); err != nil {
return fmt.Errorf("failed to edit the template and preview the changes: %w", err)
}
Expand Down

0 comments on commit 8f8b166

Please sign in to comment.