Skip to content

Commit

Permalink
Added all needed pieces to build feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Witkowski committed Sep 15, 2023
1 parent 4279889 commit 259efbf
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
47 changes: 47 additions & 0 deletions cmd/provenanced/cmd/docgen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package cmd

import (
"fmt"

"github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)

var docGenCmdStart = fmt.Sprintf("%s docgen", version.AppName)

const (
FlagMarkdown = "markdown"
FlagYaml = "yaml"
FlagRest = "rest"
FlagManpage = "manpage"
)

func GetDocGenCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "docgen",
Short: "Generates cli documentation for the Provenance Blockchain.",
Long: "",
Example: fmt.Sprintf("%s '/tmp' --yaml --markdown", docGenCmdStart),
Hidden: true,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
markdown, err := cmd.Flags().GetBool(FlagMarkdown)
if err != nil {
return err
}
if markdown {
doc.GenMarkdownTree(cmd.Root(), args[0])

Check failure on line 34 in cmd/provenanced/cmd/docgen.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value of `doc.GenMarkdownTree` is not checked (errcheck)
}

Check warning on line 35 in cmd/provenanced/cmd/docgen.go

View check run for this annotation

Codecov / codecov/patch

cmd/provenanced/cmd/docgen.go#L29-L35

Added lines #L29 - L35 were not covered by tests

return nil

Check warning on line 37 in cmd/provenanced/cmd/docgen.go

View check run for this annotation

Codecov / codecov/patch

cmd/provenanced/cmd/docgen.go#L37

Added line #L37 was not covered by tests
},
}

cmd.Flags().Bool(FlagMarkdown, false, "Generate documentation in the format of markdown pages.")
cmd.Flags().Bool(FlagYaml, false, "Generate documentation in the format of yaml.")
cmd.Flags().Bool(FlagRest, false, "Generate documentation in the format of rest.")
cmd.Flags().Bool(FlagManpage, false, "Generate documentation in the format of manpages.")

return cmd
}
1 change: 1 addition & 0 deletions cmd/provenanced/cmd/docgen_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package cmd_test
1 change: 1 addition & 0 deletions cmd/provenanced/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
AddMetaAddressCmd(),
snapshot.Cmd(newApp),
GetPreUpgradeCmd(),
GetDocGenCmd(),
)

fixDebugPubkeyRawTypeFlag(rootCmd)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ require (
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/iavl v0.19.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down Expand Up @@ -144,6 +145,7 @@ require (
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKy
github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
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.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM=
github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk=
Expand Down Expand Up @@ -1032,6 +1033,7 @@ github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
Expand Down

0 comments on commit 259efbf

Please sign in to comment.