File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change 1
1
# cobra2snooty
2
2
[ ![ CI] ( https://github.com/mongodb-labs/cobra2snooty/actions/workflows/pr.yml/badge.svg )] ( https://github.com/mongodb-labs/cobra2snooty/actions/workflows/pr.yml )
3
3
4
- WIP
4
+ ## Generate Snooty docs for the entire command tree
5
+
6
+ This program can actually generate docs for the mongocli command in the mongocli project
7
+
8
+ ``` go
9
+ package main
10
+
11
+ import (
12
+ " log"
13
+ " os"
14
+
15
+ " github.com/mongodb/mongocli/internal/cli/root"
16
+ " github.com/mongodb-labs/cobra2snooty"
17
+ )
18
+
19
+ func main () {
20
+ var profile string
21
+ const docsPermissions = 0766
22
+ if err := os.MkdirAll (" ./docs/command" , docsPermissions); err != nil {
23
+ log.Fatal (err)
24
+ }
25
+
26
+ mongocli := root.Builder (&profile, []string {})
27
+
28
+ if err := cobra2snooty.GenSnootyTree (mongocli, " ./docs/command" ); err != nil {
29
+ log.Fatal (err)
30
+ }
31
+ }
32
+ ```
33
+
34
+ This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./docs/command")
35
+
5
36
6
37
## License
7
38
You can’t perform that action at this time.
0 commit comments