MCPcopy Create free account
hub / github.com/auth0/auth0-cli / showPromptsText

Function showPromptsText

internal/cli/prompts_custom_text.go:115–147  ·  view source on GitHub ↗
(cli *cli, inputs *promptsTextInput)

Source from the content-addressed store, hash-verified

113}
114
115func showPromptsText(cli *cli, inputs *promptsTextInput) func(cmd *cobra.Command, args []string) error {
116 return func(cmd *cobra.Command, args []string) error {
117 if len(args) == 0 {
118 if err := customTextPrompt.Pick(cmd, &inputs.Prompt, customTextPromptOptions); err != nil {
119 return err
120 }
121 } else {
122 inputs.Prompt = args[0]
123 }
124
125 brandingText := make(map[string]interface{})
126 if err := ansi.Waiting(func() (err error) {
127 brandingText, err = cli.api.Prompt.CustomText(cmd.Context(), inputs.Prompt, inputs.Language)
128 return err
129 }); err != nil {
130 return fmt.Errorf(
131 "failed to fetch custom text for prompt %q and language %q: %w",
132 inputs.Prompt,
133 inputs.Language,
134 err,
135 )
136 }
137
138 brandingTextJSON, err := json.MarshalIndent(brandingText, "", " ")
139 if err != nil {
140 return fmt.Errorf("failed to serialize the prompt custom text to JSON: %w", err)
141 }
142
143 cli.renderer.BrandingTextShow(string(brandingTextJSON), inputs.Prompt, inputs.Language)
144
145 return nil
146 }
147}
148
149func updateBrandingText(cli *cli, inputs *promptsTextInput) func(cmd *cobra.Command, args []string) error {
150 return func(cmd *cobra.Command, args []string) error {

Callers 1

showPromptsTextCmdFunction · 0.85

Calls 5

WaitingFunction · 0.92
ErrorfMethod · 0.80
BrandingTextShowMethod · 0.80
CustomTextMethod · 0.65
PickMethod · 0.45

Tested by

no test coverage detected