feat: init cli command

This commit is contained in:
debugtalk
2021-10-08 20:16:31 +08:00
parent 1127bac345
commit b70a61f06d
5 changed files with 613 additions and 6 deletions

7
cmd/main/main.go Normal file
View File

@@ -0,0 +1,7 @@
package main
import "github.com/httprunner/httpboomer/cmd"
func main() {
cmd.Execute()
}

32
cmd/root.go Normal file
View File

@@ -0,0 +1,32 @@
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/httprunner/httpboomer"
)
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "httpboomer",
Short: "httpboomer = httprunner + boomer",
Long: `HttpBoomer is a golang implementation of HttpRunner.
Ideally, HttpBoomer will be fully compatible with HttpRunner, including testcase format and usage.
What's more, HttpBoomer will integrate Boomer natively to be a better load generator for locust.`,
Version: httpboomer.VERSION,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) {},
}
// 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 {
fmt.Println(err)
os.Exit(1)
}
}