...
1 package cmd
2
3 import (
4 "github.com/spf13/cobra"
5 "github.com/spf13/cobra/doc"
6 )
7
8 var dir string
9
10 var gendoc = &cobra.Command{
11 Use: "gendoc",
12 Short: "Generate in-toto-golang's help docs",
13 SilenceUsage: true,
14 Args: cobra.NoArgs,
15 RunE: func(*cobra.Command, []string) error {
16 return doc.GenMarkdownTree(rootCmd, dir)
17 },
18 }
19
20 func init() {
21 rootCmd.AddCommand(gendoc)
22 gendoc.Flags().StringVarP(&dir, "dir", "d", "doc", "Path to directory in which to generate docs")
23 }
24
View as plain text