Skip to content

Commit

Permalink
Rename rest to rst to improve clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Witkowski committed Sep 20, 2023
1 parent b847558 commit e4d1a9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions cmd/provenanced/cmd/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <target directory> (--markdown) (--yaml) (--rest) (--manpages) [flags]",
Use: "docgen <target directory> (--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),
Expand All @@ -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
}
Expand All @@ -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")
}

Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions cmd/provenanced/cmd/docgen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"},
},
{
Expand Down

0 comments on commit e4d1a9f

Please sign in to comment.