[User Interface] add method to pipe outputs to a pager

parent 2128c44a
......@@ -368,6 +368,16 @@ module Pod
warnings << { :message => message, :actions => actions, :verbose_only => verbose_only }
end
# Pipes all output inside given block to a pager.
#
def with_pager
IO.popen((ENV['PAGER'] || 'less -R'), 'w') do |io|
Signal.trap('INT','IGNORE')
UI.output_io = io
yield
end
end
private
# @!group Helpers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment