黄瓜:管输出不失颜色 [英] Cucumber: pipe output without losing color
问题描述
我使用 cucumber
运行一些测试。它使用ANSI转义对其输出进行着色。这是伟大的,但目前它产生更多的产出比我关心,和推的东西,我在屏幕上关心。似乎没有办法消除黄瓜内的其他行,但我可以通过 grep
管道输出到我关心的。 / p>
这个解决方案的缺点是,所有的颜色都丢失了。我知道这不是我的shell或grep的错,因为%echo\e [35mhello\e [00m world] | grep hello
工作正常,所以它必须是黄瓜以某种方式禁用自己的颜色。
如何管理彩色输出黄瓜的输出?
Doh。它包含在 cucumber -h
中。使用 -c
标志强制彩色输出。
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?
Doh. It's covered in cucumber -h
. Use the -c
flag to force colorized output.
这篇关于黄瓜:管输出不失颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!