mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
refactor: rename command
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
package main
|
||||
|
||||
import "github.com/httprunner/httpboomer/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
}
|
||||
15
httpboomer/cmd/gen_doc.go
Normal file
15
httpboomer/cmd/gen_doc.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package cmd
|
||||
|
||||
// import (
|
||||
// "log"
|
||||
|
||||
// "github.com/spf13/cobra/doc"
|
||||
// )
|
||||
|
||||
// func main() {
|
||||
|
||||
// err := doc.GenMarkdownTree(rootCmd, "/tmp")
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
// }
|
||||
40
httpboomer/cmd/har2case.go
Normal file
40
httpboomer/cmd/har2case.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/httprunner/httpboomer/har2case"
|
||||
)
|
||||
|
||||
// har2caseCmd represents the har2case command
|
||||
var har2caseCmd = &cobra.Command{
|
||||
Use: "har2case path...",
|
||||
Short: "Convert HAR to json/yaml testcase files",
|
||||
Long: `Convert HAR to json/yaml testcase files`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("har2case called")
|
||||
var outputFiles []string
|
||||
for _, arg := range args {
|
||||
jsonPath, _ := har2case.NewHAR(arg).GenJSON()
|
||||
outputFiles = append(outputFiles, jsonPath)
|
||||
}
|
||||
log.Printf("%v", outputFiles)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(har2caseCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// and all subcommands, e.g.:
|
||||
// har2caseCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||
|
||||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// har2caseCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
7
httpboomer/main.go
Normal file
7
httpboomer/main.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "github.com/httprunner/httpboomer/httpboomer/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
}
|
||||
Reference in New Issue
Block a user