diff --git a/echo/echo.go b/echo/echo.go index 5c9865b..543418c 100644 --- a/echo/echo.go +++ b/echo/echo.go @@ -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) }