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/tmuxedit/capture.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'internal/tmuxedit/capture.go') diff --git a/internal/tmuxedit/capture.go b/internal/tmuxedit/capture.go index 2af5698..f4e3a67 100644 --- a/internal/tmuxedit/capture.go +++ b/internal/tmuxedit/capture.go @@ -5,11 +5,17 @@ import ( "strings" ) -// capturePane retrieves the visible content of a tmux pane via -// `tmux capture-pane -p -t `. The -p flag prints to stdout -// instead of to a paste buffer. -var capturePane = func(paneID string) (string, error) { - out, err := runCommand("tmux", "capture-pane", "-p", "-t", paneID) +func capturePane(paneID string) (string, error) { + return tmuxEditDeps{}.capture(paneID) +} + +// capture retrieves the visible content of a tmux pane via `tmux capture-pane +// -p -t `. The -p flag prints to stdout instead of to a paste buffer. +func (d tmuxEditDeps) capture(paneID string) (string, error) { + if d.capturePane != nil { + return d.capturePane(paneID) + } + out, err := d.command("tmux", "capture-pane", "-p", "-t", paneID) if err != nil { return "", fmt.Errorf("capture-pane failed for %s: %w", paneID, err) } -- cgit v1.2.3