change: remove hrp har2case, replace with hrp convert

This commit is contained in:
debugtalk
2022-06-05 20:58:53 +08:00
parent baaf2b8335
commit 15f744bb30
3 changed files with 3 additions and 53 deletions

View File

@@ -1,10 +1,11 @@
# Release History
## v4.1.2 (2022-06-03)
## v4.1.2 (2022-06-05)
- fix #1331: use `str_eq` to assert string and digit equality
- fix #1336: extract package with tar in Windows
- fix: install package on MinGW64
- change: remove `hrp har2case`, replace with `hrp convert`
## v4.1.1 (2022-05-31)

View File

@@ -57,5 +57,5 @@ func init() {
convertCmd.Flags().BoolVar(&toJSONFlag, "to-json", false, "convert to JSON scripts (default)")
convertCmd.Flags().BoolVar(&toYAMLFlag, "to-yaml", false, "convert to YAML scripts")
convertCmd.Flags().StringVarP(&outputDir, "output-dir", "d", "", "specify output directory, default to the same dir with har file")
convertCmd.Flags().StringVarP(&profilePath, "profile", "p", "", "specify profile path to override headers (except for auto-generated headers) and cookies")
convertCmd.Flags().StringVarP(&profilePath, "profile", "p", "", "specify profile path to override headers and cookies")
}

View File

@@ -1,51 +0,0 @@
package cmd
import (
"errors"
"github.com/spf13/cobra"
"github.com/httprunner/httprunner/v4/hrp/internal/convert"
)
// har2caseCmd represents the har2case command
var har2caseCmd = &cobra.Command{
Use: "har2case $har_path...",
Short: "convert HAR to json/yaml testcase files",
Long: `convert HAR to json/yaml testcase files`,
Args: cobra.MinimumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
setLogLevel(logLevel)
},
RunE: func(cmd *cobra.Command, args []string) error {
var flagCount int
var har2caseOutputType convert.OutputType
if har2caseGenJSONFlag {
flagCount++
}
if har2caseGenYAMLFlag {
flagCount++
har2caseOutputType = convert.OutputTypeYAML
}
if flagCount > 1 {
return errors.New("please specify at most one conversion flag")
}
convert.Run(har2caseOutputType, har2caseOutputDir, har2caseProfilePath, args)
return nil
},
}
var (
har2caseGenJSONFlag bool
har2caseGenYAMLFlag bool
har2caseOutputDir string
har2caseProfilePath string
)
func init() {
rootCmd.AddCommand(har2caseCmd)
har2caseCmd.Flags().BoolVarP(&har2caseGenJSONFlag, "to-json", "j", false, "convert to JSON format (default)")
har2caseCmd.Flags().BoolVarP(&har2caseGenYAMLFlag, "to-yaml", "y", false, "convert to YAML format")
har2caseCmd.Flags().StringVarP(&har2caseOutputDir, "output-dir", "d", "", "specify output directory, default to the same dir with har file")
har2caseCmd.Flags().StringVarP(&har2caseProfilePath, "profile", "p", "", "specify profile path to override headers and cookies")
}