mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Added Pry.pager config option, set to true by default, if set to false
then never use a pager (if pager is invoked through stagger_output() method anyway)
This commit is contained in:
parent
f11cdf30cd
commit
f7930f0af2
2 changed files with 9 additions and 3 deletions
|
@ -63,9 +63,10 @@ class Pry
|
|||
end
|
||||
end
|
||||
|
||||
# Try to use `less` for paging, if it fails then use simple_pager
|
||||
# Try to use `less` for paging, if it fails then use
|
||||
# simple_pager. Also do not page if Pry.pager is falsey
|
||||
def stagger_output(text)
|
||||
if text.lines.count < page_size
|
||||
if text.lines.count < page_size || !Pry.pager
|
||||
output.puts text
|
||||
return
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ class Pry
|
|||
# Pry instances.
|
||||
attr_accessor :print
|
||||
|
||||
# @return [Proc] The Proc to use for printing by default by all
|
||||
# @return [Proc] The Proc to use for printing exceptions by default by all
|
||||
# Pry instances.
|
||||
attr_accessor :exception_handler
|
||||
|
||||
|
@ -83,6 +83,10 @@ class Pry
|
|||
# @return [Boolean]
|
||||
attr_accessor :color
|
||||
|
||||
# Determines whether paging (of long blocks of text) is enabled.
|
||||
# @return [Boolean]
|
||||
attr_accessor :pager
|
||||
|
||||
# Determines whether the rc file (~/.pryrc) should be loaded.
|
||||
# @return [Boolean]
|
||||
attr_accessor :should_load_rc
|
||||
|
@ -213,6 +217,7 @@ class Pry
|
|||
@hooks = DEFAULT_HOOKS
|
||||
@custom_completions = DEFAULT_CUSTOM_COMPLETIONS
|
||||
@color = true
|
||||
@pager = true
|
||||
@should_load_rc = true
|
||||
@rc_loaded = false
|
||||
@cli = false
|
||||
|
|
Loading…
Add table
Reference in a new issue