Added a new popup to modify the columns of the table. With this new popup, the user can: - Show and hide columns - Move columns around - Add new columns which are derived from the value of an expression - Delete columns Also got the overlay mechanisms working.
49 lines
803 B
Go
49 lines
803 B
Go
package events
|
|
|
|
import (
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"log"
|
|
)
|
|
|
|
func Error(err error) tea.Msg {
|
|
log.Println(err)
|
|
return ErrorMsg(err)
|
|
}
|
|
|
|
func SetStatus(msg string) tea.Cmd {
|
|
return func() tea.Msg {
|
|
return StatusMsg(msg)
|
|
}
|
|
}
|
|
|
|
func SetTeaMessage(event tea.Msg) tea.Cmd {
|
|
return func() tea.Msg {
|
|
return event
|
|
}
|
|
}
|
|
|
|
func PromptForInput(prompt string, onDone func(value string) tea.Msg) tea.Msg {
|
|
return PromptForInputMsg{
|
|
Prompt: prompt,
|
|
OnDone: onDone,
|
|
}
|
|
}
|
|
|
|
func Confirm(prompt string, onYes func() tea.Msg) tea.Msg {
|
|
return PromptForInput(prompt, func(value string) tea.Msg {
|
|
if value == "y" {
|
|
return onYes()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
type MessageWithStatus interface {
|
|
StatusMessage() string
|
|
}
|
|
|
|
type MessageWithMode interface {
|
|
MessageWithStatus
|
|
ModeMessage() string
|
|
}
|