https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-06-12T03:23:17ZRuby Issue Tracking SystemRuby master - Feature #8515: don't allow irb to dump output for forever and everhttps://bugs.ruby-lang.org/issues/8515?journal_id=398662013-06-12T03:23:17ZAnonymous
<ul></ul><p>On 06/11/2013 09:41 AM, crankharder (Josh Sharpe) wrote:</p>
<blockquote>
<p>Feature <a class="issue tracker-2 status-7 priority-4 priority-default closed" title="Feature: don't allow irb to dump output for forever and ever (Feedback)" href="https://bugs.ruby-lang.org/issues/8515">#8515</a>: don't allow irb to dump output for forever and ever<br>
<a href="https://bugs.ruby-lang.org/issues/8515" class="external">https://bugs.ruby-lang.org/issues/8515</a></p>
</blockquote>
<p>Agreed, it would be nice to have LESS(1) functionality in irb.</p>
<p>Have you tried the pry gem? It does behave like less (including regex<br>
searches).</p>
<p>If you want to use irb, there is this snippet for your .irbrc (though it<br>
seems incompatible with wirble), which abbreviates long output:</p>
<a name="credit-to-Stian-Haklev"></a>
<h1 >credit to Stian Haklev<a href="#credit-to-Stian-Haklev" class="wiki-anchor">¶</a></h1>
<p>class IRB::Context<br>
attr_accessor :max_output_size</p>
<pre><code>alias initialize_before_max_output_size initialize
def initialize(*args)
initialize_before_max_output_size(*args)
@max_output_size = IRB.conf[:MAX_OUTPUT_SIZE] || 500
end
</code></pre>
<p>end</p>
<p>class IRB::Irb<br>
def output_value<br>
text =<br>
if @context.inspect?<br>
sprintf @context.return_format, @context.last_value.inspect<br>
else<br>
sprintf @context.return_format, @context.last_value<br>
end<br>
max = @context.max_output_size<br>
if text.size < max<br>
puts text<br>
else<br>
puts text[0..max-1] + "..." + text[-2..-1]<br>
end<br>
end<br>
end</p> Ruby master - Feature #8515: don't allow irb to dump output for forever and everhttps://bugs.ruby-lang.org/issues/8515?journal_id=398752013-06-12T09:53:23Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>You can run irb with --noecho option, or set `IRB.conf[:ECHO] = false' in .irbrc.</p> Ruby master - Feature #8515: don't allow irb to dump output for forever and everhttps://bugs.ruby-lang.org/issues/8515?journal_id=483492014-08-15T02:34:11Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul> Ruby master - Feature #8515: don't allow irb to dump output for forever and everhttps://bugs.ruby-lang.org/issues/8515?journal_id=483622014-08-15T21:20:53Zavit (Andrew Vit)andrew@avit.ca
<ul></ul><p>pry's pager is very cool, but it seems that it needs to build the whole string output before it gets echoed back to the screen using <code>less</code>. Maybe something better could be done for that within irb by "streaming" the output buffer?</p>