From 4ffb22e7f69f1c9c79b095d4e60bad3d97aac55b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 18 Jun 2026 07:45:37 +0300 Subject: ik0 replace test seams with dependency injection --- internal/hexaiaction/tui.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'internal/hexaiaction/tui.go') diff --git a/internal/hexaiaction/tui.go b/internal/hexaiaction/tui.go index 9155cfe..7506cdc 100644 --- a/internal/hexaiaction/tui.go +++ b/internal/hexaiaction/tui.go @@ -124,7 +124,11 @@ func (m model) View() string { // RunTUI returns the chosen ActionKind from the default hardcoded menu. func RunTUI() (ActionKind, error) { - p := tea.NewProgram(newModel()) + return tuiRunner{}.RunTUI() +} + +func (r tuiRunner) RunTUI() (ActionKind, error) { + p := r.program(newModel()) md, err := p.Run() if err != nil { return ActionSkip, err @@ -142,8 +146,12 @@ func RunTUI() (ActionKind, error) { // Custom entries are resolved by ID against customs. Falls back to ActionSkip // if the program returns an unexpected model type. func RunTUIFromConfig(entries []appconfig.TmuxActionMenuEntry, customs []appconfig.CustomAction) (ActionKind, *appconfig.CustomAction, error) { + return tuiRunner{}.RunTUIFromConfig(entries, customs) +} + +func (r tuiRunner) RunTUIFromConfig(entries []appconfig.TmuxActionMenuEntry, customs []appconfig.CustomAction) (ActionKind, *appconfig.CustomAction, error) { m := newModelFromMenuEntries(entries, customs) - p := teaNewProgram(m) + p := r.program(m) md, err := p.Run() if err != nil { return ActionSkip, nil, err -- cgit v1.2.3