【问题标题】:How to silence Nim compile and run output?如何使 Nim 编译和运行输出静音?
【发布时间】:2020-08-15 04:10:16
【问题描述】:

如果我在 Nim 中运行 nim c -r test.nim 以下代码

echo "Hi"

它会打印带有附加信息的结果

$ nim c -r test.nim 
Hint: used config file '/usr/local/Cellar/nim/1.2.6/nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: test [Processing]
CC: stdlib_system.nim
CC: test.nim
Hint:  [Link]
Hint: 14204 LOC; 0.898 sec; 18.598MiB peakmem; Debug build; proj: /Users/alex/tmp/nim/test.nim; out: /Users/alex/tmp/nim/test [SuccessX]
Hint: /Users/alex/tmp/nim/test
Hi

有没有办法告诉它只打印结果,

Hi

【问题讨论】:

    标签: nim-lang


    【解决方案1】:

    您可以使用--hints:on|off|list 选项:

    nim c -r --hints:off test.nim
    

    请注意,关闭提示时仍会报告警告和错误。您也可以使用--warnings:on|off|list 关闭警告。这些和其他编译器开关are described here

    【讨论】:

    • 谢谢,您知道nimble run 的类似选项吗?
    • @AlexCraft -- 您可以将编译器标志传递给nimble run,但我不知道您如何让nimble 本身静音。
    猜你喜欢
    • 2016-04-15
    • 1970-01-01
    • 2022-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-10
    • 2021-05-09
    • 2021-08-18
    相关资源
    最近更新 更多