generated from okp4/template-oss
/
main.go
50 lines (42 loc) 路 1.11 KB
/
main.go
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"os"
"github.com/spf13/cobra"
"cosmossdk.io/log"
)
func main() {
rootCmd := &cobra.Command{
Use: "gendoc",
Short: "Simple CLI to generate documentation for the project",
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())
},
}
rootCmd.AddCommand(generateCommandDocumentationCommand())
rootCmd.AddCommand(generatePredicateDocumentationCommand())
if err := rootCmd.Execute(); err != nil {
log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err)
os.Exit(1)
}
}
func generateCommandDocumentationCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "command",
Short: "Generate command documentation",
RunE: func(_ *cobra.Command, _ []string) error {
return generateCommandDocumentation()
},
}
return cmd
}
func generatePredicateDocumentationCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "predicate",
Short: "Generate predicate documentation",
RunE: func(_ *cobra.Command, _ []string) error {
return generatePredicateDocumentation()
},
}
return cmd
}