开发者

Generic way to paginate output of IRB or Rails console

开发者 https://www.devze.com 2023-03-05 01:32 出处:网络
The output of an IRB command is often too large for one \"screen\" (even if I scroll up - I am using Windows - I cannot get to the start of the output).

The output of an IRB command is often too large for one "screen" (even if I scroll up - I am using Windows - I cannot get to the start of the output).

Is there a generic way to scroll/paginate through the output of IRB/Rails console. In Unix you use "| more" or "| less" to do so, but that doesn't work in IRB.

The workaround I am using now is to apply ranges on enumerables, example:

puts YAML::dump User.methods.s开发者_StackOverflow社区ort[0..50]
puts YAML::dump User.methods.sort[50..100]

etc...

I've also seen extra plugins to install or monkeypatching IRB, but I was wondering whether there was something natively built in...


You can use hirb, it's a small extension library for irb and it has pagination among other enchantments.

0

精彩评论

暂无评论...
验证码 换一张
取 消