File tree 2 files changed +17
-4
lines changed
2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -163,11 +163,16 @@ func (s *shellActionsImpl) HelpText() string {
163
163
164
164
func showPaged (s * Shell , text string ) error {
165
165
var cmd * exec.Cmd
166
- if runtime .GOOS == "windows" {
167
- cmd = exec .Command ("more" )
168
- } else {
169
- cmd = exec .Command ("less" )
166
+
167
+ if s .pager == "" {
168
+ if runtime .GOOS == "windows" {
169
+ s .pager = "more"
170
+ } else {
171
+ s .pager = "less"
172
+ }
170
173
}
174
+
175
+ cmd = exec .Command (s .pager , s .pagerArgs ... )
171
176
cmd .Stdout = s .writer
172
177
cmd .Stderr = s .writer
173
178
cmd .Stdin = bytes .NewBufferString (text )
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ type Shell struct {
50
50
autoHelp bool
51
51
rawArgs []string
52
52
progressBar ProgressBar
53
+ pager string
54
+ pagerArgs []string
53
55
contextValues
54
56
Actions
55
57
}
@@ -410,6 +412,12 @@ func (s *Shell) SetOut(writer io.Writer) {
410
412
s .writer = writer
411
413
}
412
414
415
+ // SetPager sets the pager and its arguments for paged output
416
+ func (s * Shell ) SetPager (pager string , args []string ) {
417
+ s .pager = pager
418
+ s .pagerArgs = args
419
+ }
420
+
413
421
func initSelected (init []int , max int ) []int {
414
422
selectedMap := make (map [int ]bool )
415
423
for _ , i := range init {
You can’t perform that action at this time.
0 commit comments