feat: gen markdown docs for command

This commit is contained in:
debugtalk
2021-10-11 15:33:15 +08:00
parent beaf5adaef
commit 09fdaa8c35
11 changed files with 147 additions and 21 deletions

View File

@@ -40,7 +40,7 @@ var cpuProfile string
var cpuProfileDuration time.Duration
func init() {
rootCmd.AddCommand(boomCmd)
RootCmd.AddCommand(boomCmd)
boomCmd.Flags().Int64Var(&maxRPS, "max-rps", 0, "Max RPS that boomer can generate, disabled by default.")
boomCmd.Flags().StringVar(&requestIncreaseRate, "request-increase-rate", "-1", "Request increase rate, disabled by default.")

View File

@@ -1,15 +0,0 @@
package cmd
// import (
// "log"
// "github.com/spf13/cobra/doc"
// )
// func main() {
// err := doc.GenMarkdownTree(rootCmd, "/tmp")
// if err != nil {
// log.Fatal(err)
// }
// }

View File

@@ -26,7 +26,7 @@ var har2caseCmd = &cobra.Command{
}
func init() {
rootCmd.AddCommand(har2caseCmd)
RootCmd.AddCommand(har2caseCmd)
// Here you will define your flags and configuration settings.

View File

@@ -9,8 +9,8 @@ import (
"github.com/httprunner/httpboomer"
)
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Use: "httpboomer",
Short: "One-stop solution for HTTP(S) testing.",
Long: `HttpBoomer is the next generation for HttpRunner. Enjoy! ✨ 🚀 ✨
@@ -24,7 +24,7 @@ Copyright 2021 debugtalk`,
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}

View File

@@ -34,7 +34,7 @@ var runCmd = &cobra.Command{
}
func init() {
rootCmd.AddCommand(runCmd)
RootCmd.AddCommand(runCmd)
runCmd.Flags().BoolP("silent", "s", false, "Disable logging request & response details")
// runCmd.Flags().BoolP("gen-html-report", "r", false, "Generate HTML report")
}