mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 14:50:55 +01:00
28 lines
787 B
Go
28 lines
787 B
Go
package tui
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/charmbracelet/lipgloss"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
var SeriousBusiness = lipgloss.NewStyle().Foreground(lipgloss.Color("#D90166"))
|
|
var ErrorLabel = SeriousBusiness.Render("ERROR")
|
|
var Attention = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFA500"))
|
|
var WarningLabel = Attention.Render("WARNING")
|
|
var Code = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FFFF"))
|
|
|
|
func Error(msg string, err error) {
|
|
if err != nil {
|
|
_, _ = fmt.Fprintf(os.Stderr, "[%v]: %v (%v)\n", ErrorLabel, msg, strings.TrimSpace(err.Error()))
|
|
} else {
|
|
_, _ = fmt.Fprintf(os.Stderr, "[%v] %v\n", ErrorLabel, msg)
|
|
}
|
|
os.Exit(1)
|
|
}
|
|
|
|
func Warning(msg string, v ...interface{}) {
|
|
_, _ = fmt.Fprintf(os.Stderr, "%v: "+msg+"\n", append([]interface{}{WarningLabel}, v...))
|
|
}
|