MCPcopy Index your code
hub / github.com/cli/cli / runMarkdownEditor

Function runMarkdownEditor

pkg/cmd/preview/prompter/prompter.go:263–287  ·  view source on GitHub ↗
(p prompter.Prompter, io *iostreams.IOStreams)

Source from the content-addressed store, hash-verified

261}
262
263func runMarkdownEditor(p prompter.Prompter, io *iostreams.IOStreams) error {
264 defaultText := "default text value"
265
266 fmt.Fprintln(io.Out, "Demonstrating Markdown Editor with blanks allowed and default text")
267 editorText, err := p.MarkdownEditor("Edit your text:", defaultText, true)
268 if err != nil {
269 return err
270 }
271 fmt.Fprintf(io.Out, "Returned text: %s\n\n", editorText)
272
273 fmt.Fprintln(io.Out, "Demonstrating Markdown Editor with blanks disallowed and default text")
274 editorText2, err := p.MarkdownEditor("Edit your text:", defaultText, false)
275 if err != nil {
276 return err
277 }
278 fmt.Fprintf(io.Out, "Returned text: %s\n\n", editorText2)
279
280 fmt.Fprintln(io.Out, "Demonstrating Markdown Editor with blanks disallowed and no default text")
281 editorText3, err := p.MarkdownEditor("Edit your text:", "", false)
282 if err != nil {
283 return err
284 }
285 fmt.Fprintf(io.Out, "Returned text: %s\n", editorText3)
286 return nil
287}

Callers

nothing calls this directly

Calls 1

MarkdownEditorMethod · 0.65

Tested by

no test coverage detected