51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
|
package tui
|
||
|
|
||
|
import "github.com/charmbracelet/bubbles/key"
|
||
|
|
||
|
type KeyMappings struct {
|
||
|
Update key.Binding
|
||
|
SearchCriteria key.Binding
|
||
|
Search key.Binding
|
||
|
StorageOptions key.Binding
|
||
|
Find key.Binding
|
||
|
Quit key.Binding
|
||
|
}
|
||
|
|
||
|
func (k KeyMappings) ShortHelp() []key.Binding {
|
||
|
return []key.Binding{k.Update, k.SearchCriteria, k.Search, k.StorageOptions, k.Find, k.Quit}
|
||
|
}
|
||
|
|
||
|
func (k KeyMappings) FullHelp() [][]key.Binding {
|
||
|
return [][]key.Binding{
|
||
|
{k.Update, k.SearchCriteria, k.Search},
|
||
|
{k.StorageOptions, k.Find, k.Quit},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var KeyMap = KeyMappings{
|
||
|
Update: key.NewBinding(
|
||
|
key.WithKeys("u"),
|
||
|
key.WithHelp("u", "update database"),
|
||
|
),
|
||
|
SearchCriteria: key.NewBinding(
|
||
|
key.WithKeys("c"),
|
||
|
key.WithHelp("c", "card printing search criteria"),
|
||
|
),
|
||
|
Search: key.NewBinding(
|
||
|
key.WithKeys("s"),
|
||
|
key.WithHelp("s", "card printing search"),
|
||
|
),
|
||
|
StorageOptions: key.NewBinding(
|
||
|
key.WithKeys("o"),
|
||
|
key.WithHelp("o", "card storage options"),
|
||
|
),
|
||
|
Find: key.NewBinding(
|
||
|
key.WithKeys("f"),
|
||
|
key.WithHelp("f", "find in storage"),
|
||
|
),
|
||
|
Quit: key.NewBinding(
|
||
|
key.WithKeys("ctrl+c", "q"),
|
||
|
key.WithHelp("q", "quit program"),
|
||
|
),
|
||
|
}
|