...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package main
16
17 import (
18 "fmt"
19 "os"
20
21 "github.com/google/go-containerregistry/cmd/crane/cmd"
22 "github.com/spf13/cobra"
23 "github.com/spf13/cobra/doc"
24 )
25
26 var dir string
27 var root = &cobra.Command{
28 Use: "gendoc",
29 Short: "Generate crane's help docs",
30 Args: cobra.NoArgs,
31 RunE: func(*cobra.Command, []string) error {
32 return doc.GenMarkdownTree(cmd.Root, dir)
33 },
34 }
35
36 func init() {
37 root.Flags().StringVarP(&dir, "dir", "d", ".", "Path to directory in which to generate docs")
38 }
39
40 func main() {
41 if err := root.Execute(); err != nil {
42 fmt.Println(err)
43 os.Exit(1)
44 }
45 }
46
View as plain text