ChronoTomato/cmd/client/keys.go

45 lines
854 B
Go
Raw Permalink Normal View History

package client
import "github.com/charmbracelet/bubbles/key"
// keyMap defines a set of keybindings. To work for help it must satisfy
// key.Map. It could also very easily be a map[string]key.Binding.
type keyMap struct {
Start key.Binding
Stop key.Binding
Reset key.Binding
Quit key.Binding
}
var keys = keyMap{
Start: key.NewBinding(
key.WithKeys(" "),
key.WithHelp("space", "start/pause/resume"),
),
Stop: key.NewBinding(
key.WithKeys("s"),
key.WithHelp("s", "stop"),
),
Reset: key.NewBinding(
key.WithKeys("r"),
key.WithHelp("r", "reset"),
),
Quit: key.NewBinding(
key.WithKeys("q"),
key.WithHelp("q", "quit"),
),
}
func (k keyMap) ShortHelp() []key.Binding {
return []key.Binding{
keys.Start,
keys.Stop,
keys.Reset,
keys.Quit,
}
}
func (k keyMap) FullHelp() [][]key.Binding {
return [][]key.Binding{}
}