From af7d0d7d427695b7ad22f9a79f42892dd643045d Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sun, 5 Jun 2022 20:58:53 +0800 Subject: [PATCH] change: remove hrp har2case, replace with hrp convert --- docs/CHANGELOG.md | 3 ++- hrp/cmd/convert.go | 2 +- hrp/cmd/har2case.go | 51 --------------------------------------------- 3 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 hrp/cmd/har2case.go diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 57e6cbf9..fdb14855 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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) diff --git a/hrp/cmd/convert.go b/hrp/cmd/convert.go index a4c8d663..83ba88bb 100644 --- a/hrp/cmd/convert.go +++ b/hrp/cmd/convert.go @@ -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") } diff --git a/hrp/cmd/har2case.go b/hrp/cmd/har2case.go deleted file mode 100644 index 7d6f1994..00000000 --- a/hrp/cmd/har2case.go +++ /dev/null @@ -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") -}