Skip to content

Commit 98708e8

Browse files
committed
Default to more pager on Windows
1 parent ba29502 commit 98708e8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

internal/pkg/print/print.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bufio"
55
"errors"
66
"fmt"
7+
"runtime"
78

89
"log/slog"
910
"os"
@@ -163,13 +164,17 @@ func (p *Printer) PagerDisplay(content string) error {
163164
if outputFormat == NoneOutputFormat {
164165
return nil
165166
}
166-
lessCmd := exec.Command("less", "-F", "-S", "-w")
167-
lessCmd.Stdin = strings.NewReader(content)
168-
lessCmd.Stdout = p.Cmd.OutOrStdout()
167+
pagerCmd := exec.Command("less", "-F", "-S", "-w")
168+
if runtime.GOOS == "windows" {
169+
pagerCmd = exec.Command("more")
170+
}
171+
172+
pagerCmd.Stdin = strings.NewReader(content)
173+
pagerCmd.Stdout = p.Cmd.OutOrStdout()
169174

170-
err := lessCmd.Run()
175+
err := pagerCmd.Run()
171176
if err != nil {
172-
p.Debug(ErrorLevel, "run less command: %v", err)
177+
p.Debug(ErrorLevel, "run pager command: %v", err)
173178
p.Outputln(content)
174179
}
175180
return nil

0 commit comments

Comments
 (0)