strip-beats/io/message/message.go

21 lines
384 B
Go
Raw Normal View History

2023-11-11 18:51:38 -06:00
package message
2023-09-03 22:39:40 -05:00
import "github.com/rivo/tview"
2023-11-11 18:51:38 -06:00
func Message(text string) {
2023-09-03 22:39:40 -05:00
app := tview.NewApplication()
2023-09-04 15:10:02 -05:00
modal := tview.NewModal()
if text != "" {
modal.SetText(text)
}
2023-11-11 18:51:38 -06:00
modal.AddButtons([]string{"Ok"}).
2023-09-04 15:10:02 -05:00
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
2023-09-03 22:39:40 -05:00
app.Stop()
})
2023-09-04 15:10:02 -05:00
if err := app.SetRoot(modal, false).EnableMouse(true).Run(); err != nil {
2023-09-03 22:39:40 -05:00
panic(err)
}
}