I am making a command line tool using Ruby. It will print a lot of text on the screen. I am currently using a shell pipeline ( may_app | more ) for this. But I think it's better to have a default pager.
This is just what you see when doing git log . You can disable the pager using git --nopager log .
I did a lot of work on Google and found one stone: hirb , but that seems a bit crowded.
After many attempts, I use a shell wrapper for this:
#!/bin/bash # xray.rb is the core script # doing the main logic and will # output many rows of text on # screen XRAY=$HOME/fdev-xray/xray.rb if [ "--nopager" == "$1" ]; then shift $XRAY $* else $XRAY $* | more fi
It works. But is there a better way?
source share