File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments