summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/util/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/util/util.go')
-rw-r--r--internal/tui/util/util.go33
1 files changed, 30 insertions, 3 deletions
diff --git a/internal/tui/util/util.go b/internal/tui/util/util.go
index f6cf20d60..e006cbb43 100644
--- a/internal/tui/util/util.go
+++ b/internal/tui/util/util.go
@@ -9,12 +9,39 @@ func CmdHandler(msg tea.Msg) tea.Cmd {
}
func ReportError(err error) tea.Cmd {
- return CmdHandler(ErrorMsg(err))
+ return CmdHandler(InfoMsg{
+ Type: InfoTypeError,
+ Msg: err.Error(),
+ })
+}
+
+type InfoType int
+
+const (
+ InfoTypeInfo InfoType = iota
+ InfoTypeWarn
+ InfoTypeError
+)
+
+func ReportInfo(info string) tea.Cmd {
+ return CmdHandler(InfoMsg{
+ Type: InfoTypeInfo,
+ Msg: info,
+ })
+}
+
+func ReportWarn(warn string) tea.Cmd {
+ return CmdHandler(InfoMsg{
+ Type: InfoTypeWarn,
+ Msg: warn,
+ })
}
type (
- InfoMsg string
- ErrorMsg error
+ InfoMsg struct {
+ Type InfoType
+ Msg string
+ }
ClearStatusMsg struct{}
)