12345678910111213141516171819202122232425262728293031323334353637383940 |
- package console
- import (
- "fmt"
- "github.com/mgutz/ansi"
- "os"
- )
- func Success(msg string) {
- colorOut(msg, "green")
- }
- func Error(msg string) {
- colorOut(msg, "red")
- }
- func Warning(msg string) {
- colorOut(msg, "yellow")
- }
- func Exit(msg string) {
- Error(msg)
- os.Exit(1)
- }
- func ExitIf(err error) {
- if err != nil {
- Exit(err.Error())
- }
- }
- func colorOut(message, color string) {
- _, _ = fmt.Fprintln(os.Stdout, ansi.Color(message, color))
- }
|