blob: c440805cb9e4597bcbf16fd34edddba1e7af01d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
func newGendocCmd(cli *CLI) *cobra.Command {
return &cobra.Command{
Use: "gendoc directory",
Short: "Generate documentation from '--help' pages and write as Markdown files to a given directory",
Args: cobra.ExactArgs(1),
Hidden: true, // Not intended to be called by users
DisableAutoGenTag: true,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
dir := args[0]
err := doc.GenMarkdownTree(cli.cmd, dir)
if err != nil {
return fmt.Errorf("failed to write documentation pages: %w", err)
}
cli.printSuccess("Documentation pages written to ", dir)
return nil
},
}
}
|