From 5139efad8f409676ad08cfebbf53d9003ffeb731 Mon Sep 17 00:00:00 2001 From: Aaron Chen <462826@qq.com> Date: Wed, 28 Aug 2019 12:34:07 +0800 Subject: [PATCH] config global params if not init when checkout test cases --- src/action/gen.go | 6 ++++++ src/utils/config/config.go | 12 ++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/action/gen.go b/src/action/gen.go index 8c9a3433..0c3dc886 100644 --- a/src/action/gen.go +++ b/src/action/gen.go @@ -15,6 +15,12 @@ func GenerateScript(productId string, moduleId string, suiteId string, taskId st config := configUtils.ReadCurrConfig() if config.Url == "" || config.Account == "" || config.Password == "" { + configUtils.ConfigForSet() + } + + if (productId != "") || (moduleId != "" && productId != "") || suiteId != "" || taskId != "" { + + } else { configUtils.ConfigForCheckout(&productId, &moduleId, &suiteId, &taskId, &independentFile, &scriptLang) } diff --git a/src/utils/config/config.go b/src/utils/config/config.go index 0acd0acd..4d3a2f83 100644 --- a/src/utils/config/config.go +++ b/src/utils/config/config.go @@ -52,7 +52,7 @@ func ConfigForSet() { language = "zh" } else { if language == "" { - fmt.Print(languageDefault) + fmt.Print("English") } language = languageDefault } @@ -77,12 +77,6 @@ func ConfigForSet() { func ConfigForCheckout(productId *string, moduleId *string, suiteId *string, taskId *string, independentFile *bool, scriptLang *string) { - color.Cyan("\n" + i118Utils.I118Prt.Sprintf("need_config")) - - url := getInput("http://.*", "enter_url") - account := getInput(".{3,}", "enter_account") - password := getInput(".{4,}", "enter_password") - coType := getInput("(product|module|suite|task|p|m|s|t)", "enter_co_type") coType = strings.ToLower(coType) @@ -99,7 +93,7 @@ func ConfigForCheckout(productId *string, moduleId *string, suiteId *string, tas indep := getInput("(yes|no|y|n|)", "enter_co_independent") indep = strings.ToLower(indep) - if indep != "yes" && indep != "y" { // default no + if indep == "yes" && indep == "y" { *independentFile = true } else { if indep == "" { @@ -112,8 +106,6 @@ func ConfigForCheckout(productId *string, moduleId *string, suiteId *string, tas fmtParam := strings.Join(langUtils.GetSupportLangageArr(), " / ") *scriptLang = getInput(regx, "enter_co_language", fmtParam) - SaveConfig("en", url, account, password) - PrintCurrConfig() } -- GitLab