黄瓜:管道输出不失色
我正在使用 cucumber
来运行一些测试。它使用 ANSI 转义对其输出进行着色。这很棒,但目前它产生的输出比我关心的要多,并且将我真正关心的东西推到了屏幕之外。似乎没有办法消除 Cucumber 中的其他行,但我可以通过 grep
管道输出以减少我关心的行。
但该解决方案的缺点是所有颜色都会丢失。我知道这不是我的 shell 或 grep 的错,因为 % echo "\e[35mhello\e[00m world" | grep hello
工作得很好,所以它一定是黄瓜以某种方式禁用了自己的颜色。
当我通过管道传输黄瓜的输出时,如何保留彩色输出?
I'm using cucumber
to run some tests. It colorizes its output using ANSI escapes. This is great, but currently its producing more output than I care about, and shoving things I do care about off the screen. There doesn't seem to be a way to eliminate the other lines from within cucumber, but I can pipe the output through grep
to pare down to the ones I care about.
The downside of this solution, though, is that all the colors are lost. I know it's not my shell or grep's fault, because % echo "\e[35mhello\e[00m world" | grep hello
works just fine, so it must be cucumber disabling its own color somehow.
How can I preserve the colored output when I pipe the output of cucumber?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哦。它包含在
cucumber -h
中。使用-c
标志强制彩色输出。Doh. It's covered in
cucumber -h
. Use the-c
flag to force colorized output.