- Converted Tamarin script language to Risor - Added a "find" and "merge" method to the result set script type. - Added the ability to copy the table of results to the pasteboard by pressing C - Added the -q flag, which will run a query and display the results as a CSV file on the command line - Upgraded Go to 1.21 in Github actions - Fix issue with missing limits - Added the '-where' switch to the mark - Added the 'marked' function to the query expression. - Added a sampled time and count on the right-side of the mode line - Added the 'M' key binding to toggle the marked items - Started working on tab completion for 'sa' and 'da' commands - Added count and sample time to the right-side of the mode line - Added Ctrl+V to the prompt to paste the text of the pasteboard with all whitespace characters trimmed - Fixed failing unit tests
62 lines
1.2 KiB
Go
62 lines
1.2 KiB
Go
package events
|
|
|
|
import (
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/lmika/dynamo-browse/internal/dynamo-browse/services"
|
|
"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, history services.HistoryProvider, onDone func(value string) tea.Msg) tea.Msg {
|
|
return PromptForInputMsg{
|
|
Prompt: prompt,
|
|
History: history,
|
|
OnDone: onDone,
|
|
}
|
|
}
|
|
|
|
func Confirm(prompt string, onResult func(yes bool) tea.Msg) tea.Msg {
|
|
return PromptForInput(prompt, nil, func(value string) tea.Msg {
|
|
return onResult(value == "y")
|
|
})
|
|
}
|
|
|
|
func ConfirmYes(prompt string, onYes func() tea.Msg) tea.Msg {
|
|
return PromptForInput(prompt, nil, func(value string) tea.Msg {
|
|
if value == "y" {
|
|
return onYes()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
type MessageWithStatus interface {
|
|
StatusMessage() string
|
|
}
|
|
|
|
type MessageWithMode interface {
|
|
MessageWithStatus
|
|
ModeMessage() string
|
|
}
|
|
|
|
type MessageWithRightMode interface {
|
|
MessageWithStatus
|
|
RightModeMessage() string
|
|
}
|