diff --git a/cmd/provenanced/cmd/docgen.go b/cmd/provenanced/cmd/docgen.go index ec4465df50..f59b6e1ea1 100644 --- a/cmd/provenanced/cmd/docgen.go +++ b/cmd/provenanced/cmd/docgen.go @@ -15,16 +15,16 @@ var docGenCmdStart = fmt.Sprintf("%s docgen", version.AppName) const ( FlagMarkdown = "markdown" FlagYaml = "yaml" - FlagRest = "rest" + FlagRst = "rst" FlagManpage = "manpage" ) func GetDocGenCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "docgen (--markdown) (--yaml) (--rest) (--manpages) [flags]", + Use: "docgen (--markdown) (--yaml) (--rst) (--manpages) [flags]", Short: "Generates cli documentation for the Provenance Blockchain.", Long: `Generates cli documentation for the Provenance Blockchain. -Various documentation formats can be generated, including markdown, YAML, REST, and man pages. +Various documentation formats can be generated, including markdown, YAML, RST, and man pages. To ensure the command's success, you must specify at least one format. A successful command will not only generate files in the selected formats but also create the target directory if it doesn't already exist.`, Example: fmt.Sprintf("%s '/tmp' --yaml --markdown", docGenCmdStart), @@ -39,7 +39,7 @@ A successful command will not only generate files in the selected formats but al if err != nil { return err } - rest, err := cmd.Flags().GetBool(FlagRest) + rst, err := cmd.Flags().GetBool(FlagRst) if err != nil { return err } @@ -48,7 +48,7 @@ A successful command will not only generate files in the selected formats but al return err } - if !markdown && !yaml && !rest && !manpage { + if !markdown && !yaml && !rst && !manpage { return fmt.Errorf("at least one doc type must be specified") } @@ -72,7 +72,7 @@ A successful command will not only generate files in the selected formats but al return err } } - if rest { + if rst { err = doc.GenReSTTree(cmd.Root(), dir) if err != nil { return err @@ -91,7 +91,7 @@ A successful command will not only generate files in the selected formats but al 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(FlagRst, false, "Generate documentation in the format of rst.") cmd.Flags().Bool(FlagManpage, false, "Generate documentation in the format of manpages.") return cmd diff --git a/cmd/provenanced/cmd/docgen_test.go b/cmd/provenanced/cmd/docgen_test.go index 719612581b..9b92feda7e 100644 --- a/cmd/provenanced/cmd/docgen_test.go +++ b/cmd/provenanced/cmd/docgen_test.go @@ -55,11 +55,11 @@ func TestDocGen(t *testing.T) { err: "invalid argument \"xyz\" for \"--yaml\" flag: strconv.ParseBool: parsing \"xyz\": invalid syntax", }, { - name: "failure - bad rest value", + name: "failure - bad rst value", target: "tmp", createTarget: true, - flags: []string{"--rest=xyz"}, - err: "invalid argument \"xyz\" for \"--rest\" flag: strconv.ParseBool: parsing \"xyz\": invalid syntax", + flags: []string{"--rst=xyz"}, + err: "invalid argument \"xyz\" for \"--rst\" flag: strconv.ParseBool: parsing \"xyz\": invalid syntax", }, { name: "failure - bad markdown value", @@ -83,10 +83,10 @@ func TestDocGen(t *testing.T) { extensions: []string{".yaml"}, }, { - name: "success - rest is generated", + name: "success - rst is generated", target: "tmp", createTarget: true, - flags: []string{"--rest"}, + flags: []string{"--rst"}, extensions: []string{".rst"}, }, {