如何禁用 sbt/play 的彩色终端输出?
我想禁用从 sbt/play 记录的颜色转义代码。这可能吗?如果是,有没有一种方法可以在不更改配置的情况下完成此操作 - 即通过命令行开关或系统属性。
I would like to disable the color escape codes logged from sbt/play. Is this possible? And if it is, is there a way to do it without making changes to the config - i.e. via a command line switch or system property.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
从
0.13.8
版本(可能更早)开始,您现在可以简单地使用 sbt 的-no-colors
选项。例如Since version
0.13.8
(and possibly earlier) you can now simply use the-no-colors
option to sbt. e.g.您只需将系统属性
sbt.log.noformat
设置为true
即可。例如,如果您想在 Vim 中使用 SBT,您可以创建如下脚本:You can simply set the system property
sbt.log.noformat
totrue
. If you want to e.g. use SBT inside Vim you can create a script like this:这听起来像是您的平台与实际的 jline.terminal 属性不匹配。我只是在这里猜测,但是当我按照 Daniel 在 Windows 命令行上建议的方式传递参数时,我也会看到颜色转义代码。
因此,您必须确保该属性与您的平台相匹配,即Windows 上的WindowsTerminal 和Unix 上的UnixTerminal。
如果这没有帮助,那么您可能使用的是不受支持的平台,在这种情况下,网站建议使用:
This sounds like your platform does not match the actual jline.terminal property. I am just guessing here but when I pass the parameter as Daniel suggested on a Windows command line I see the color escape codes as well.
Therefore, you have to make sure the property matches your platform, i.e. WindowsTerminal on Windows and UnixTerminal on Unix.
If this does not help, then you might be on an unsupported platform in which case the website suggests to use:
好吧,您可以通过安装 Cygwin 并传递此参数来在 Windows 上获取颜色:
因此我会查找 jline 参数以查看禁用颜色编码的内容。
Well, you can get colors on Windows by installing Cygwin and passing this parameter:
So I'd look up jline parameters to see what disables color coding.
我可以通过添加以下内容从 Cygwin 中的 SBT 获得彩色输出:
另外,我发现我还需要将以下行添加到 Cygwin.bat:
添加后,SBT 提供了非常漂亮的彩色输出。另外,我建议查看 Console2,因为它可以通过 Cygwin 挂钩,但在我看来提供了更好的界面:
http: //sourceforge.net/projects/console/
I was able to get colored output from SBT in Cygwin by adding:
Additionally I figured out that I also needed to add the following line to Cygwin.bat:
After that is added SBT gives very nice colored output. Additionally I would recommend looking into Console2 as it can hook through Cygwin, but provides a much better interface in my opinion:
http://sourceforge.net/projects/console/