diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-18 07:45:37 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-18 07:45:37 +0300 |
| commit | 4ffb22e7f69f1c9c79b095d4e60bad3d97aac55b (patch) | |
| tree | 2dc708cbb95975d34084eb5afd376871caa13e27 /internal/tmuxedit/capture.go | |
| parent | ece7dcfd232b780f5650326c8ac2379ca70387d4 (diff) | |
ik0 replace test seams with dependency injection
Diffstat (limited to 'internal/tmuxedit/capture.go')
| -rw-r--r-- | internal/tmuxedit/capture.go | 16 |
1 files changed, 11 insertions, 5 deletions
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 <paneID>`. 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 <paneID>`. 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) } |
