echo - add Error func

This commit is contained in:
Mahdi Abu Yasmine 2023-11-09 00:02:27 +01:00
parent eb55a2b266
commit 6204d8cffc

View File

@ -2,6 +2,7 @@ package echo
import (
"fmt"
"os"
"strings"
"gitea.meta-tech.academy/go/core/style"
@ -79,6 +80,16 @@ func LineUp(count int) {
fmt.Printf("\033[%dA", count)
}
func Error(msg string, exit ...bool) {
fmt.Printf(" ")
Cstyle("ko").Echof(" %s ", msg)
Ln()
Ln()
if len(exit) > 0 && exit[0] {
os.Exit(1)
}
}
func GetArg(msg string) string {
return Cstyle("usageArg").Applyf(" % s", msg)
}