Delete Data Conversion Tool

pull/2059/head
skiffer-git 2 years ago
parent f02785905c
commit a2459cc9b5

@ -65,6 +65,24 @@ type checkFunc struct {
config *config.GlobalConfig config *config.GlobalConfig
} }
// colorErrPrint prints formatted string in red to stderr
func colorErrPrint(format string, a ...interface{}) {
// ANSI escape code for red text
const redColor = "\033[31m"
// ANSI escape code to reset color
const resetColor = "\033[0m"
// Format the string as per provided format and arguments
errMsg := fmt.Sprintf(format, a...)
// Print to stderr in red
fmt.Fprintf(os.Stderr, redColor+errMsg+resetColor)
}
func colorSuccessPrint(format string, a ...interface{}) {
// ANSI escape code for green text is \033[32m
// \033[0m resets the color
fmt.Printf("\033[32m"+format+"\033[0m", a...)
}
func main() { func main() {
flag.Parse() flag.Parse()
@ -102,16 +120,16 @@ func main() {
err = check.function(check.config) err = check.function(check.config)
if err != nil { if err != nil {
allSuccess = false allSuccess = false
component.ErrorPrint(fmt.Sprintf("Check component: %s, failed: %s", check.name, err.Error())) colorErrPrint(fmt.Sprintf("Check component: %s, failed: %s", check.name, err.Error()))
if check.name == "Minio" { if check.name == "Minio" {
if errors.Is(err, errMinioNotEnabled) || if errors.Is(err, errMinioNotEnabled) ||
errors.Is(err, errSignEndPoint) || errors.Is(err, errSignEndPoint) ||
errors.Is(err, errApiURL) { errors.Is(err, errApiURL) {
fmt.Fprintf(os.Stderr, err.Error(), " check ", check.name) colorErrPrint("Check ", check.name, err.Error())
checks[index].flag = true checks[index].flag = true
continue continue
} }
break break
} }
} else { } else {
checks[index].flag = true checks[index].flag = true

Loading…
Cancel
Save