summaryrefslogtreecommitdiff
path: root/internal/tmuxedit/capture.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tmuxedit/capture.go')
-rw-r--r--internal/tmuxedit/capture.go16
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)
}