docs(cli): added makefile and go file to create docs (#3930)

Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
This commit is contained in:
Krishna Dutt Panchagnula
2023-04-01 11:13:21 +05:30
committed by GitHub
parent a2f39a34c5
commit ed590966a3
3 changed files with 14 additions and 1 deletions

1
go.mod
View File

@@ -199,6 +199,7 @@ require (
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/containerd/ttrpc v1.1.0 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect

1
go.sum
View File

@@ -674,6 +674,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=

View File

@@ -12,6 +12,9 @@ import (
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
"github.com/magefile/mage/target"
"github.com/spf13/cobra/doc"
"github.com/aquasecurity/trivy/pkg/commands"
)
var (
@@ -356,7 +359,15 @@ func (Docs) Serve() error {
// Generate generates CLI references
func (Docs) Generate() error {
// TODO
ver, err := version()
if err != nil {
return err
}
cmd := commands.NewApp(ver)
cmd.DisableAutoGenTag = true
if err = doc.GenMarkdownTree(cmd, "./docs/docs/references/cli"); err != nil {
return err
}
return nil
}