File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 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 {
163163
164164func showPaged (s * Shell , text string ) error {
165165 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+ }
170173 }
174+
175+ cmd = exec .Command (s .pager , s .pagerArgs ... )
171176 cmd .Stdout = s .writer
172177 cmd .Stderr = s .writer
173178 cmd .Stdin = bytes .NewBufferString (text )
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ type Shell struct {
5050 autoHelp bool
5151 rawArgs []string
5252 progressBar ProgressBar
53+ pager string
54+ pagerArgs []string
5355 contextValues
5456 Actions
5557}
@@ -410,6 +412,12 @@ func (s *Shell) SetOut(writer io.Writer) {
410412 s .writer = writer
411413}
412414
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+
413421func initSelected (init []int , max int ) []int {
414422 selectedMap := make (map [int ]bool )
415423 for _ , i := range init {
You can’t perform that action at this time.
0 commit comments