summaryrefslogtreecommitdiff
path: root/actions.go
diff options
context:
space:
mode:
authortjp <tjp@ctrl-c.club>2024-01-03 20:16:51 -0700
committertjp <tjp@ctrl-c.club>2024-01-03 20:16:51 -0700
commit2eee2b05608cb57051bac5774d03c3c7fc5f110b (patch)
tree46247212c4b33ffe0bcdd77426b8b7d9d43f6565 /actions.go
parent1eec3cbbc2da95e116e70ab3911766886e499988 (diff)
auto_pager config option
Diffstat (limited to 'actions.go')
-rw-r--r--actions.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/actions.go b/actions.go
index c2dd934..065b673 100644
--- a/actions.go
+++ b/actions.go
@@ -320,6 +320,19 @@ func print(state *BrowserState) error {
if state.Modal != nil {
out = state.Modal
}
+
+ if state.AutoPager {
+ less, err := exec.LookPath("less")
+ if err != nil {
+ return err
+ }
+ cmd := exec.Command(less, "-F")
+ cmd.Stdin = bytes.NewBuffer(out)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ return cmd.Run()
+ }
+
_, err := os.Stdout.Write(out)
return err
}