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

color related update

上级 08d39c9a
......@@ -37,8 +37,8 @@ func CommitBug(files []string) {
}
for {
logUtils.PrintToStdOut("\n"+i118Utils.I118Prt.Sprintf("enter_case_id_for_report_bug"), color.FgCyan)
logUtils.PrintToStdOut(strings.Join(lines, "\n"), -1)
logUtils.PrintToWithColor("\n"+i118Utils.I118Prt.Sprintf("enter_case_id_for_report_bug"), color.FgCyan)
logUtils.PrintToWithColor(strings.Join(lines, "\n"), -1)
var caseId string
fmt.Scanln(&caseId)
......@@ -50,7 +50,7 @@ func CommitBug(files []string) {
if stringUtils.FindInArr(caseId, ids) {
page.CuiReportBug(resultDir, caseId)
} else {
logUtils.PrintToStdOut(i118Utils.I118Prt.Sprintf("invalid_input"), color.FgRed)
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("invalid_input"), color.FgRed)
}
}
}
......
......@@ -50,9 +50,9 @@ func Generate(productId string, moduleId string, suiteId string, taskId string,
if err == nil {
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("success_to_generate", count, targetDir) + "\n")
} else {
logUtils.PrintToStdOut(err.Error(), color.FgRed)
logUtils.PrintToWithColor(err.Error(), color.FgRed)
}
} else {
logUtils.PrintToStdOut(i118Utils.I118Prt.Sprintf("no_cases"), color.FgRed)
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("no_cases"), color.FgRed)
}
}
......@@ -108,11 +108,11 @@ func View(cases []string, keywords string) {
numb := fmt.Sprintf("#%0"+strconv.Itoa(width)+"d", idx+1)
logUtils.PrintTo(logUtils.GetWholeLine(numb+" "+arr[3], "="))
logUtils.PrintToStdOut(fmt.Sprintf("%s. %s", arr[0], arr[1]), color.FgCyan)
logUtils.PrintToWithColor(fmt.Sprintf("%s. %s", arr[0], arr[1]), color.FgCyan)
fmt.Printf("Steps: \n%s \n", arr[2])
logUtils.PrintToStdOut("", -1)
logUtils.PrintToWithColor("", -1)
}
}
......
......@@ -225,7 +225,7 @@ func CommitCase(caseId int, title string, stepMap maps.Map, stepTypeMap maps.Map
"expects": commonUtils.LinkedMapToMap(expectMap)}
var yes bool
logUtils.PrintToStdOut("\n"+i118Utils.I118Prt.Sprintf("case_update_confirm", caseId, title), -1)
logUtils.PrintToWithColor("\n"+i118Utils.I118Prt.Sprintf("case_update_confirm", caseId, title), -1)
stdinUtils.InputForBool(&yes, true, "want_to_continue")
if yes {
......
......@@ -53,7 +53,7 @@ func SaveConfig(conf model.Config) error {
}
func PrintCurrConfig() {
logUtils.PrintToStdOut("\n"+i118Utils.I118Prt.Sprintf("current_config"), color.FgCyan)
logUtils.PrintToWithColor("\n"+i118Utils.I118Prt.Sprintf("current_config"), color.FgCyan)
val := reflect.ValueOf(vari.Config)
typeOfS := val.Type()
......@@ -117,7 +117,7 @@ func InputForSet() {
var configSite bool
logUtils.PrintToStdOut(i118Utils.I118Prt.Sprintf("begin_config"), color.FgCyan)
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("begin_config"), color.FgCyan)
enCheck := ""
var numb string
......@@ -171,7 +171,7 @@ func CheckRequestConfig() {
func InputForRequest() {
conf := ReadCurrConfig()
logUtils.PrintToStdOut(i118Utils.I118Prt.Sprintf("need_config"), color.FgCyan)
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("need_config"), color.FgCyan)
conf.Url = stdinUtils.GetInput("(http://.*)", conf.Url, "enter_url", conf.Url)
conf.Account = stdinUtils.GetInput("(.{2,})", conf.Account, "enter_account", conf.Account)
......
......@@ -132,7 +132,7 @@ func GetSupportLanguageExtArr() []string {
func CheckSupportLanguages(scriptLang string) bool {
if LangMap[scriptLang] == nil {
langStr := strings.Join(GetSupportLanguageArrSort(), ", ")
logUtils.PrintToStdOut(i118Utils.I118Prt.Sprintf("only_support_script_language", langStr)+"\n", color.FgRed)
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("only_support_script_language", langStr)+"\n", color.FgRed)
return false
}
......
......@@ -19,7 +19,7 @@ var (
)
func PrintUsage() {
PrintToStdOut("Usage: ", color.FgCyan)
PrintToWithColor("Usage: ", color.FgCyan)
usage := fileUtils.ReadResData(usageFile)
exeFile := "ztf"
......@@ -29,7 +29,7 @@ func PrintUsage() {
usage = fmt.Sprintf(usage, exeFile)
fmt.Printf("%s\n", usage)
PrintToStdOut("\nExample: ", color.FgCyan)
PrintToWithColor("\nExample: ", color.FgCyan)
sample := fileUtils.ReadResData(sampleFile)
if !commonUtils.IsWin() {
regx, _ := regexp.Compile(`\\`)
......@@ -52,7 +52,7 @@ func PrintTo(str string) {
fmt.Fprint(output, str+"\n")
}
func PrintToStdOut(msg string, attr color.Attribute) {
func PrintToWithColor(msg string, attr color.Attribute) {
output := color.Output
if attr == -1 {
......
......@@ -104,11 +104,11 @@ func GetInput(regx string, defaultVal string, fmtStr string, params ...interface
msg := i118Utils.I118Prt.Sprintf(fmtStr, params...)
for {
logUtils.PrintToStdOut("\n"+msg, color.FgCyan)
logUtils.PrintToWithColor("\n"+msg, color.FgCyan)
// fmt.Scanln(&ret)
Scanf(&ret)
//logUtils.PrintToStdOut(fmt.Sprintf("%v", ret), -1)
//logUtils.PrintToWithColor(fmt.Sprintf("%v", ret), -1)
if strings.TrimSpace(ret) == "" && defaultVal != "" {
ret = defaultVal
......@@ -122,7 +122,7 @@ func GetInput(regx string, defaultVal string, fmtStr string, params ...interface
os.Exit(0)
}
//logUtils.PrintToStdOut(ret, -1)
//logUtils.PrintToWithColor(ret, -1)
if regx == "" {
return ret
......@@ -142,7 +142,7 @@ func GetInput(regx string, defaultVal string, fmtStr string, params ...interface
return ret
} else {
ret = ""
logUtils.PrintToStdOut(i118Utils.I118Prt.Sprintf(msg), color.FgRed)
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf(msg), color.FgRed)
}
}
}
......@@ -153,7 +153,7 @@ func GetInputForScriptInterpreter(defaultVal string, fmtStr string, params ...in
msg := i118Utils.I118Prt.Sprintf(fmtStr, params...)
for {
logUtils.PrintToStdOut("\n"+msg, color.FgCyan)
logUtils.PrintToWithColor("\n"+msg, color.FgCyan)
Scanf(&ret)
ret = strings.TrimSpace(ret)
......@@ -161,7 +161,7 @@ func GetInputForScriptInterpreter(defaultVal string, fmtStr string, params ...in
if ret == "" && defaultVal != "" {
ret = defaultVal
logUtils.PrintToStdOut(ret, -1)
logUtils.PrintToWithColor(ret, -1)
}
if ret == "exit" {
......@@ -183,7 +183,7 @@ func GetInputForScriptInterpreter(defaultVal string, fmtStr string, params ...in
return ret
} else {
ret = ""
logUtils.PrintToStdOut(i118Utils.I118Prt.Sprintf("invalid_input"), color.FgRed)
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("invalid_input"), color.FgRed)
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册