qhw*_*hwa 6 ruby command-line pager
我正在使用Ruby制作命令行工具.它会在屏幕上打印很多文字.目前,我正在使用shell pipeline(may_app | more)这样做.但我认为最好有一个默认的寻呼机.
它就像你执行时看到的那样git log.可以使用禁用寻呼机git --nopager log.
我做了很多谷歌工作并找到了一个宝石:hirb,但它似乎有点矫枉过正.
经过多次尝试,我目前正在使用shell包装器来执行此操作:
#!/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
Run Code Online (Sandbox Code Playgroud)
有用.但有更好的方法吗?
| 归档时间: |
|
| 查看次数: |
641 次 |
| 最近记录: |