Skip to content

Commit c5186c0

Browse files
committed
docs: update README
1 parent 9927b6b commit c5186c0

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
11
# cobra2snooty
22
[![CI](https://github.com/mongodb-labs/cobra2snooty/actions/workflows/pr.yml/badge.svg)](https://github.com/mongodb-labs/cobra2snooty/actions/workflows/pr.yml)
33

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+
536

637
## License
738

0 commit comments

Comments
 (0)