-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added all needed pieces to build feature.
- Loading branch information
Matthew Witkowski
committed
Sep 15, 2023
1 parent
4279889
commit 259efbf
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package cmd_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters