Skip to content

Improve "docsgen" program's usability as a "template" #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions workflow-templates/assets/cobra/docsgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package main
import (
"os"

// TODO: Replace CLI_PACKAGE_NAME with the project's Cobra CLI package name
"CLI_PACKAGE_NAME"
// TODO: Replace CLI_PACKAGE_NAME with the project's Cobra CLI package import path
cli "CLI_PACKAGE_NAME"
"github.com/spf13/cobra/doc"
)

Expand All @@ -31,7 +31,8 @@ func main() {

os.MkdirAll(os.Args[1], 0755) // Create the output folder if it doesn't already exist

cli := cli.Root()
// TODO: Replace `cli.NewCommand()` with the project's Cobra CLI package function for command root
cli := cli.NewCommand()
cli.DisableAutoGenTag = true // Disable addition of auto-generated date stamp
err := doc.GenMarkdownTree(cli, os.Args[1])
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ If there are any additional documentation generation tasks, add them to the `doc
#### `docsgen`

- [`go.mod`](assets/cobra/docsgen/go.mod) - replace `MODULE_NAME` with the project's module name.
- [`main.go`](assets/cobra/docsgen/main.go) - replace `CLI_PACKAGE_NAME` with the project's Cobra CLI package name
- [`main.go`](assets/cobra/docsgen/main.go)
- replace `CLI_PACKAGE_NAME` with the project's Cobra CLI package name
- replace `cli.NewCommand()` with the project's Cobra CLI package function for [command root](https://github.com/spf13/cobra/blob/master/user_guide.md#create-rootcmd) generation

Run the following command from the `docsgen/` folder:

Expand Down