[英]Elixir mix test set color to default to enabled
In my project I can run the command mix test --color
which adds some colored output to the terminal.在我的项目中,我可以运行命令mix test --color
,它将一些彩色 output 添加到终端。 I would like to set this globally, so I can just run mix test
and it automatically picks up that I want the output colored.我想全局设置它,所以我可以运行mix test
,它会自动选择我想要 output 着色。
What I've tried...我试过的...
mix help
too and couldn't see anything about global configuration.我也尝试过mix help
,但看不到有关全局配置的任何信息。mix help test
as well, it doesn't seem clear to me here how to add the option to the mix.exs
file, or if it's possible to set global options somewhere.我也尝试过mix help test
,我似乎不清楚如何将选项添加到mix.exs
文件,或者是否可以在某处设置全局选项。I feel like this is probably possible, but after not coming up with anything I thought I'd ask here.我觉得这可能是可能的,但是在没有想出任何我想在这里问的东西之后。
I am not aware of the system-wide, global setting.我不知道系统范围的全局设置。 It might be easily done, though, on a per-project basis with :aliases
option given to what MyApp.MixProject.project/0
callback in your mix.exs
file returns.但是,可以很容易地在每个项目的基础上使用:aliases
选项来完成mix.exs
文件中的MyApp.MixProject.project/0
回调返回的内容。
defmodule MyApp.MixProject do
use Mix.Project
def project do
[
app: :my_app,
version: "0.1.0",
...
aliases: [test: "test --color"], # this
...
]
end
...
Aliases are designed to provide exactly this functionality: mix test
would now call mix test --color
under the hood.别名旨在提供此功能: mix test
现在将在引擎盖下调用mix test --color
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.