如何运行“颜色” NAnt 脚本中的命令
我刚刚开始使用 Nant 进行构建和测试。我想让它在失败时更改命令提示符文本的颜色(或背景),以便很容易注意到。
Windows 上命令提示符中的命令是“color 4”,将其更改为红色,“color 7”将其更改回白色。
我如何使其在构建脚本中运行,echo 不起作用,exec 不起作用(尽管可能使用了 exec 错误)。我宁愿不必运行 perl 等,只是为了做一些在标准命令提示符窗口中轻松完成的事情。
有谁知道该怎么做?
I've just started using Nant for my builds and tests. I want to make it change the color (or background) of my command prompt text when it fails so its easily noticed.
The command in command prompt on Windows is 'color 4' to change it to red and color 7 for back to white.
How do I make this run in a build script, echo doesn't work, exec doesn't work (may be using exec wrong though). I'd prefer to not have to run perl etc just to do something which is easily done in a standard command prompt window.
Does anyone know how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用自定义任务。如果该任务包含在 nant 文件中,您将不会有任何外部依赖项。
Try using a custom task. If the task is included in the nant-file you'll not have any external dependency.
作为我对 @Martin-Vobr 帖子的评论的后续:
我添加了额外的逻辑来正确更改背景。这将允许在命令窗口中启动构建,然后可以一目了然地检查进度。我使用蓝色背景表示“构建”,绿色表示“成功”,红色表示“失败”。
As a follow up to my comment on the post by @Martin-Vobr:
I have added additional logic to properly change the background. This will allow a build to be initiated in a command window, then progress can be checked at a glance. I use a blue background for "building", green for "Success" and red for "Failure".