Skip to content

Commit 8283fff

Browse files
authored
Merge pull request #144 from per1234/templatier-docsgen
Improve "docsgen" program's usability as a "template"
2 parents b42989c + 89886b3 commit 8283fff

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

workflow-templates/assets/cobra/docsgen/main.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ package main
1818
import (
1919
"os"
2020

21-
// TODO: Replace CLI_PACKAGE_NAME with the project's Cobra CLI package name
22-
"CLI_PACKAGE_NAME"
21+
// TODO: Replace CLI_PACKAGE_NAME with the project's Cobra CLI package import path
22+
cli "CLI_PACKAGE_NAME"
2323
"github.com/spf13/cobra/doc"
2424
)
2525

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

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

34-
cli := cli.Root()
34+
// TODO: Replace `cli.NewCommand()` with the project's Cobra CLI package function for command root
35+
cli := cli.NewCommand()
3536
cli.DisableAutoGenTag = true // Disable addition of auto-generated date stamp
3637
err := doc.GenMarkdownTree(cli, os.Args[1])
3738
if err != nil {

workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ If there are any additional documentation generation tasks, add them to the `doc
4545
#### `docsgen`
4646

4747
- [`go.mod`](assets/cobra/docsgen/go.mod) - replace `MODULE_NAME` with the project's module name.
48-
- [`main.go`](assets/cobra/docsgen/main.go) - replace `CLI_PACKAGE_NAME` with the project's Cobra CLI package name
48+
- [`main.go`](assets/cobra/docsgen/main.go)
49+
- replace `CLI_PACKAGE_NAME` with the project's Cobra CLI package name
50+
- 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
4951

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

0 commit comments

Comments
 (0)