(cmd *cobra.Command, dir string)
| 25 | } |
| 26 | |
| 27 | func GenMdxTree(cmd *cobra.Command, dir string) error { |
| 28 | tpl, err := template.New("mdx.tpl").Funcs(template.FuncMap{ |
| 29 | "getExamples": func(cmd Command) []Example { |
| 30 | return cmd.ExamplesList() |
| 31 | }, |
| 32 | "formatAlgoliaDocLinks": formatAlgoliaDocLinks, |
| 33 | "trimTrailingNewlines": trimTrailingNewlines, |
| 34 | }).Parse(mdxTemplate) |
| 35 | if err != nil { |
| 36 | return err |
| 37 | } |
| 38 | |
| 39 | return writeMdxPageTree(tpl, dir, newMdxPage(describeCommand(cmd))) |
| 40 | } |
| 41 | |
| 42 | func newMdxPage(cmd Command) mdxPage { |
| 43 | page := mdxPage{ |