提交 7ec7db4d 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

code refactoring for exe logic

上级 ff7d5381
......@@ -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",
......
......@@ -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",
......
......@@ -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
......
......@@ -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
......
......@@ -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&params=%s", model, methd, paramStr)
}
logUtils.PrintToCmd(uri, -1)
return uri
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册