diff --git a/res/messages_en.json b/res/messages_en.json index 42afbbcc03cfc244e70629db0d51fe66e9dbfbcc..76bf3612d6a19105426c4724f4602429877fe87a 100644 --- a/res/messages_en.json +++ b/res/messages_en.json @@ -78,13 +78,13 @@ }, { "id": "enter_co_type", - "message": "enter co type", - "translation": "import test cases from? Product / Module / Suite / Task" + "message": "", + "translation": "Import test cases from?\n1. Product\n2. Module\n3. Suite\n4. Task" }, { "id": "enter_co_independent", "message": "enter co independent", - "translation": "save expect results in independent file? Yes / No, default No" + "translation": "Save expect results in independent file[y/N]?" }, { "id": "enter_co_language", @@ -381,15 +381,30 @@ "message": "ZentaoUrl", "translation": "ZentaoUrl" }, + { + "id": "pls_input", + "message": "", + "translation": "Please input" + }, { "id": "product_id", - "message": "ProductId", - "translation": "ProductId" + "message": "", + "translation": "Product Id" + }, + { + "id": "module_id", + "message": "", + "translation": "Module Id" + }, + { + "id": "suite_id", + "message": "", + "translation": "Suite Id" }, { "id": "task_id", - "message": "TaskId", - "translation": "TaskId" + "message": "", + "translation": "Task Id" }, { "id": "independent_expect_result", diff --git a/res/messages_zh.json b/res/messages_zh.json index 87e8a2c6c7ba66888db291aef2b96022e2690980..8a2fd9c1ec7bf15ab827de7ffd18c8ad618603e3 100644 --- a/res/messages_zh.json +++ b/res/messages_zh.json @@ -373,16 +373,33 @@ "message": "ZentaoUrl", "translation": "禅道地址" }, + + { + "id": "pls_input", + "message": "", + "translation": "请输入" + }, { "id": "product_id", - "message": "ProductId", - "translation": "产品ID" + "message": "", + "translation": "产品Id" + }, + { + "id": "module_id", + "message": "", + "translation": "模块Id" + }, + { + "id": "suite_id", + "message": "", + "translation": "套件Id" }, { "id": "task_id", - "message": "TaskId", - "translation": "任务ID" + "message": "", + "translation": "任务Id" }, + { "id": "independent_expect_result", "message": "Indep. Result", diff --git a/src/service/zentao/testcase.go b/src/service/zentao/testcase.go index ba417983b24b3427fdcd7b92afbd3ad4d9d196cf..44e8d024ba1862f93d2fd85396fc0999ebcc70ae 100644 --- a/src/service/zentao/testcase.go +++ b/src/service/zentao/testcase.go @@ -220,7 +220,7 @@ func CommitCase(caseId int, title string) { var yes bool logUtils.PrintToStdOut("\n"+i118Utils.I118Prt.Sprintf("case_update_confirm", title), -1) - stdinUtils.InputForBool(&yes, "want_to_continue") + stdinUtils.InputForBool(&yes, true, "want_to_continue") if yes { url := config.Url + uri diff --git a/src/utils/stdin/stdin.go b/src/utils/stdin/stdin.go index 175e61d27e5fdfd2a7ce1334706016412798e7fb..0a227ac1220066701b839c7c77f70b01a0a39461 100644 --- a/src/utils/stdin/stdin.go +++ b/src/utils/stdin/stdin.go @@ -77,50 +77,52 @@ func InputForRequest() { func InputForCheckout(productId *string, moduleId *string, suiteId *string, taskId *string, independentFile *bool, scriptLang *string) { - coType := getInput("(product|module|suite|task|p|m|s|t)", "enter_co_type") + coType := getInput("(1|2|3|4)", "enter_co_type") coType = strings.ToLower(coType) - if coType == "product" || coType == "p" { - *productId = getInput("\\d+", "productId") - } else if coType == "module" || coType == "m" { - *productId = getInput("\\d+", "productId") - *moduleId = getInput("\\d+", "moduleId") - } else if coType == "suite" || coType == "s" { - *suiteId = getInput("\\d+", "suiteId") - } else if coType == "task" || coType == "t" { - *taskId = getInput("\\d+", "taskId") + if coType == "1" { + *productId = getInput("\\d+", + i118Utils.I118Prt.Sprintf("pls_input")+" "+i118Utils.I118Prt.Sprintf("product_id")) + + } else if coType == "2" { + *productId = getInput("\\d+", + i118Utils.I118Prt.Sprintf("pls_input")+" "+i118Utils.I118Prt.Sprintf("product_id")) + + *moduleId = getInput("\\d+", + i118Utils.I118Prt.Sprintf("pls_input")+" "+i118Utils.I118Prt.Sprintf("module_id")) + + } else if coType == "3" { + *suiteId = getInput("\\d+", + i118Utils.I118Prt.Sprintf("pls_input")+" "+i118Utils.I118Prt.Sprintf("suite_id")) + } else if coType == "4" { + *taskId = getInput("\\d+", + i118Utils.I118Prt.Sprintf("pls_input")+" "+i118Utils.I118Prt.Sprintf("task_id")) } - indep := getInput("(yes|no|y|n|)", "enter_co_independent") - indep = strings.ToLower(indep) - if indep == "yes" && indep == "y" { - *independentFile = true - } else { - if indep == "" { - fmt.Print("no") - } - *independentFile = false - } + InputForBool(independentFile, false, "enter_co_independent") regx := langUtils.GetSupportLangageRegx() fmtParam := strings.Join(langUtils.GetSupportLangageArr(), " / ") *scriptLang = getInput(regx, "enter_co_language", fmtParam) - - configUtils.PrintCurrConfig() } func InputForDir(dir *string, entity string) { *dir = getInput("is_dir", "enter_dir", i118Utils.I118Prt.Sprintf(entity)) } -func InputForInt(in *string, entity string) { - *in = getInput("\\d+", "enter_id", i118Utils.I118Prt.Sprintf(entity)) +func InputForInt(in *string, fmtStr string, fmtParam ...string) { + *in = getInput("\\d+", "fmtStr", fmtParam) } -func InputForBool(in *bool, entity string) { - str := getInput("(yes|no|y|n)", i118Utils.I118Prt.Sprintf(entity), "") +func InputForBool(in *bool, defaultVal bool, fmtStr string, fmtParam ...string) { + str := getInput("(yes|no|y|n|)", fmtStr, fmtParam) + + if str == "" { + *in = defaultVal + return + } - if str != "n" && str != "no" { + if str == "y" && str != "yes" { *in = true } else { *in = false diff --git a/src/utils/zentao/zentao.go b/src/utils/zentao/zentao.go index 7090c955880450d2790b75976392cc9676717c29..f45419c9feb40ae7fe4c4deb620d19b806b50ead 100755 --- a/src/utils/zentao/zentao.go +++ b/src/utils/zentao/zentao.go @@ -6,7 +6,6 @@ import ( constant "github.com/easysoft/zentaoatf/src/utils/const" dateUtils "github.com/easysoft/zentaoatf/src/utils/date" fileUtils "github.com/easysoft/zentaoatf/src/utils/file" - logUtils "github.com/easysoft/zentaoatf/src/utils/log" "github.com/easysoft/zentaoatf/src/utils/vari" "os" "path" @@ -40,8 +39,6 @@ func GenSuperApiUri(model string, methd string, params [][]string) string { } else { uri = fmt.Sprintf("?m=api&f=getmodel&model=%s&methodName=%s¶ms=%s", model, methd, paramStr) } - - logUtils.PrintToCmd(uri, -1) return uri }