diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-25 10:17:40 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-25 10:17:40 +0200 |
| commit | fa93934f341c7356b63daaf0c27cbdbb6e22fad7 (patch) | |
| tree | d1c61ab90ecbb6a7b141ed092221313ac4e34309 | |
| parent | 7ca1eeaa98a58471a2214a2274d20b71206af2a1 (diff) | |
Add dir-group key binding to shared TUI keymap
| -rw-r--r-- | internal/tui/common/keys.go | 4 | ||||
| -rw-r--r-- | internal/tui/common/keys_test.go | 31 |
2 files changed, 34 insertions, 1 deletions
diff --git a/internal/tui/common/keys.go b/internal/tui/common/keys.go index 7b70d5a..92d946c 100644 --- a/internal/tui/common/keys.go +++ b/internal/tui/common/keys.go @@ -13,6 +13,7 @@ type KeyMap struct { Five key.Binding Six key.Binding Seven key.Binding + DirGroup key.Binding Export key.Binding Quit key.Binding Help key.Binding @@ -36,6 +37,7 @@ func DefaultKeyMap() KeyMap { Five: key.NewBinding(key.WithKeys("5"), key.WithHelp("5", "lat+gaps")), Six: key.NewBinding(key.WithKeys("6"), key.WithHelp("6", "stream")), Seven: key.NewBinding(key.WithKeys("7"), key.WithHelp("7", "stream")), + DirGroup: key.NewBinding(key.WithKeys("d"), key.WithHelp("d", "dir group")), Export: key.NewBinding(key.WithKeys("e"), key.WithHelp("e", "export")), Quit: key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit")), Help: key.NewBinding(key.WithKeys("?"), key.WithHelp("?", "help")), @@ -61,7 +63,7 @@ func (k KeyMap) DashboardFullHelp() [][]key.Binding { if help := k.Export.Help(); help.Key != "" || help.Desc != "" { controls = append(controls, k.Export) } - controls = append(controls, k.Refresh, k.Help, k.Quit) + controls = append(controls, k.DirGroup, k.Refresh, k.Help, k.Quit) return [][]key.Binding{ {k.One, k.Two, k.Three, k.Four, k.Five, k.Six}, diff --git a/internal/tui/common/keys_test.go b/internal/tui/common/keys_test.go new file mode 100644 index 0000000..e8762c9 --- /dev/null +++ b/internal/tui/common/keys_test.go @@ -0,0 +1,31 @@ +package common + +import "testing" + +func TestDefaultKeyMapIncludesDirGroupBinding(t *testing.T) { + keys := DefaultKeyMap() + help := keys.DirGroup.Help() + if help.Key != "d" || help.Desc != "dir group" { + t.Fatalf("unexpected dir group binding help: key=%q desc=%q", help.Key, help.Desc) + } +} + +func TestDashboardFullHelpIncludesDirGroupBinding(t *testing.T) { + keys := DefaultKeyMap() + groups := keys.DashboardFullHelp() + if len(groups) < 2 { + t.Fatalf("expected at least 2 help groups") + } + + found := false + for _, binding := range groups[1] { + help := binding.Help() + if help.Key == "d" && help.Desc == "dir group" { + found = true + break + } + } + if !found { + t.Fatalf("expected dir group binding in dashboard full help controls") + } +} |
