From c5186c0469c75e974deec7810cc8fc0737f05032 Mon Sep 17 00:00:00 2001 From: Gustavo Bazan Date: Mon, 28 Jun 2021 12:59:53 +0100 Subject: [PATCH] docs: update README --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a47fdc..c992996 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,38 @@ # cobra2snooty [![CI](https://github.com/mongodb-labs/cobra2snooty/actions/workflows/pr.yml/badge.svg)](https://github.com/mongodb-labs/cobra2snooty/actions/workflows/pr.yml) -WIP +## Generate Snooty docs for the entire command tree + +This program can actually generate docs for the mongocli command in the mongocli project + +```go +package main + +import ( + "log" + "os" + + "github.com/mongodb/mongocli/internal/cli/root" + "github.com/mongodb-labs/cobra2snooty" +) + +func main() { + var profile string + const docsPermissions = 0766 + if err := os.MkdirAll("./docs/command", docsPermissions); err != nil { + log.Fatal(err) + } + + mongocli := root.Builder(&profile, []string{}) + + if err := cobra2snooty.GenSnootyTree(mongocli, "./docs/command"); err != nil { + log.Fatal(err) + } +} +``` + +This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./docs/command") + ## License