예제 #1
0
// renderProblems print error and warn messages
func renderProblems(problems []*Problem) {
	for _, problem := range problems {
		switch problem.Type {
		case PROBLEM_WARN:
			fmtc.Printf("{y}WARNING →{!} {*}%s{!}\n\n", problem.Info)
		case PROBLEM_ERR:
			fmtc.Printf("{r}ERROR →{!} {*}%s{!}\n\n", problem.Info)
		}

		fmtc.Println(fmtutil.Wrap(problem.Desc, "  ", 86))
		fmtc.NewLine()
	}
}
예제 #2
0
// renderLine render different type of source line
func renderLine(line string, dataType int) {
	switch dataType {
	case TYPE_EMPTY_LINE:
		fmtc.NewLine()
	case TYPE_SEPARATOR:
		fmtc.Printf("{s}%s{!} %s {s}%s{!}\n", line[:3], line[3:22], line[22:])
	case TYPE_HEADER:
		fmtc.Printf("{s}%s{!}\n", line)
	case TYPE_RECORD:
		sepIndex := strings.Index(line, ":")
		fmtc.Printf("{*}%s{!} %s\n", line[:sepIndex+1], line[sepIndex+1:])
	}
}