黄瓜:管道输出不失色

发布于 2024-09-24 23:51:28 字数 341 浏览 1 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晚雾 2024-10-01 23:51:28

哦。它包含在cucumber -h 中。使用 -c 标志强制彩色输出。

Doh. It's covered in cucumber -h. Use the -c flag to force colorized output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文