File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed
Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -51,12 +51,14 @@ func main() {
5151 os .Exit (2 )
5252 }
5353
54- prompt , _ := cfg .Get ("" , "prompt" )
55-
56- if prompt == config .PromptsDisabled {
54+ if prompt , _ := cfg .Get ("" , "prompt" ); prompt == config .PromptsDisabled {
5755 cmdFactory .IOStreams .SetNeverPrompt (true )
5856 }
5957
58+ if pager , _ := cfg .Get ("" , "pager" ); pager != "" {
59+ cmdFactory .IOStreams .SetPager (pager )
60+ }
61+
6062 expandedArgs := []string {}
6163 if len (os .Args ) > 0 {
6264 expandedArgs = os .Args [1 :]
Original file line number Diff line number Diff line change @@ -180,6 +180,15 @@ func NewBlankRoot() *yaml.Node {
180180 Kind : yaml .ScalarNode ,
181181 Value : PromptsEnabled ,
182182 },
183+ {
184+ HeadComment : "A pager program to send command output to. Example value: less" ,
185+ Kind : yaml .ScalarNode ,
186+ Value : "pager" ,
187+ },
188+ {
189+ Kind : yaml .ScalarNode ,
190+ Value : "" ,
191+ },
183192 {
184193 HeadComment : "Aliases allow you to create nicknames for gh commands" ,
185194 Kind : yaml .ScalarNode ,
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ func Test_defaultConfig(t *testing.T) {
4545 editor:
4646 # When to interactively prompt. This is a global config that cannot be overriden by hostname. Supported values: enabled, disabled
4747 prompt: enabled
48+ # A pager program to send command output to. Example value: less
49+ pager:
4850 # Aliases allow you to create nicknames for gh commands
4951 aliases:
5052 co: pr checkout
Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ func (s *IOStreams) IsStderrTTY() bool {
9292 return false
9393}
9494
95+ func (s * IOStreams ) SetPager (cmd string ) {
96+ s .pagerCommand = cmd
97+ }
98+
9599func (s * IOStreams ) StartPager () error {
96100 if s .pagerCommand == "" || ! s .IsStdoutTTY () {
97101 return nil
You can’t perform that action at this time.
0 commit comments