From 89094fecf4cb1c018f15c976641cd18c255eac28 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 23 Nov 2024 18:12:03 -0500 Subject: Semi-working POC --- internal/picker/keys.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 internal/picker/keys.go (limited to 'internal/picker/keys.go') diff --git a/internal/picker/keys.go b/internal/picker/keys.go new file mode 100644 index 0000000..f5b7135 --- /dev/null +++ b/internal/picker/keys.go @@ -0,0 +1,29 @@ +package picker + +import "github.com/charmbracelet/bubbles/key" + +type keybinds struct { + next, prev key.Binding +} + +func newKeybinds() keybinds { + return keybinds{ + next: key.NewBinding( + key.WithKeys("j", "down"), + key.WithHelp("j", "previous slider"), + ), + prev: key.NewBinding( + key.WithKeys("k", "up"), + key.WithHelp("k", "next slider"), + ), + } +} + +func Keys() []key.Binding { + k := newKeybinds() + return []key.Binding{k.next, k.prev} +} + +func (m Model) AllKeys() []key.Binding { + return append(Keys(), m.sliders[m.active].AllKeys()...) +} -- cgit v1.2.3