pipeplot-控制台中管道的数据流的交互式可视化

对于那些不想离开控制台的人,他们喜欢它的ascii图形,出现了一个用于从管道绘制图形的实用程序。在猫动画和实例下。




ping ya.ru | grep --line-buffered time | sed -u -e 's#.*time=\([^ ]*\).*#\1#' | pipeplot --min 0

可以通过covidAPI跟踪冠状病毒


while true; \
    do curl -s https://coronavirus-19-api.herokuapp.com/all \
    | jq '.deaths'; \
    sleep 60; \
done \
| pipeplot --color 1 --direction left

需要安装jq来解析json

五百通石墨


while true; \
do \
    curl -s 'http://graphite/render?target=my_app_rps_error&format=json&from=-5min&until=now' \
    | jq -c '.[0].datapoints[-1]'; \
    sleep 5; \
done \
| sed -u s/null/0/ \
| stdbuf -oL uniq \
| stdbuf -oL jq '.[0]' \
| pipeplot

正在缓冲


许多控制台实用程序会缓冲stdout。因此,串行管道中断。一些实用程序支持缓冲:sed -ugrep --line-buffered否则,可以使用通用方法stdbuf -oLunbuffer

可用选项


所述COLOR --color -列的颜色,调色板的数量使用的Xterm
--symbol的SYMBOL -符号来显示列支持密封
--scale所有{,}窗口 -设定自动缩放最小值和最大值,所有-考虑到的所有数据,窗口-仅可见
--direction {向左,向右} –方向
--min MIN –max MAX-固定最小值和最大值,并自动缩放

安装


pip install pipeplot

PS:欢迎来到github项目^-^。用PRs或注释写您的示例。我将添加最有趣的自述文件!

All Articles