MCPcopy Create free account
hub / github.com/AdRoll/baker / RenderHelpMarkdown

Function RenderHelpMarkdown

help_markdown.go:14–29  ·  view source on GitHub ↗

RenderHelpMarkdown prints markdown formatted help for a single component or for all of them (with name = '*'), and renders it so that it can be printed on a terminal.

(w io.Writer, name string, comp Components)

Source from the content-addressed store, hash-verified

12// for all of them (with name = '*'), and renders it so that it can be
13// printed on a terminal.
14func RenderHelpMarkdown(w io.Writer, name string, comp Components) error {
15 r, _ := glamour.NewTermRenderer(
16 // detect background color and pick either the default dark or light theme
17 glamour.WithAutoStyle(),
18 // wrap output at specific width
19 glamour.WithWordWrap(int(terminalWidth())),
20 )
21
22 if err := PrintHelp(r, name, comp, HelpFormatMarkdown); err != nil {
23 return err
24 }
25
26 r.Close()
27 _, err := io.Copy(w, r)
28 return err
29}
30
31// GenerateMarkdownHelp generates markdown-formatted textual help for a Baker
32// component from its description structure. Markdown is written into w.

Callers 2

mainFunction · 0.92
MainCLIFunction · 0.85

Calls 4

PrintHelpFunction · 0.85
terminalWidthFunction · 0.70
CloseMethod · 0.65
CopyMethod · 0.65

Tested by

no test coverage detected