From 93fa47f2ae868e9476f1dd33572022ef0bed4dbf Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 25 May 2023 11:50:13 +0300 Subject: feat(tvix/cli): add --no-warnings argument This will prevent tvix from printing any warnings. As a followup, we can also thread this parameter through into the evaluator itself, to prevent warnings from being constructed in first place. Change-Id: I15381396f86573484bdd1a73d09034a665638e35 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8646 Reviewed-by: tazjin Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/cli/src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs index c588472592..28b75dd907 100644 --- a/tvix/cli/src/main.rs +++ b/tvix/cli/src/main.rs @@ -43,6 +43,10 @@ struct Args { #[clap(long)] compile_only: bool, + /// Don't print warnings. + #[clap(long)] + no_warnings: bool, + /// A colon-separated list of directories to use to resolve `<...>`-style paths #[clap(long, short = 'I', env = "NIX_PATH")] nix_search_path: Option, @@ -126,8 +130,10 @@ fn interpret(code: &str, path: Option, args: &Args, explain: bool) -> b error.fancy_format_stderr(&source_map); } - for warning in &result.warnings { - warning.fancy_format_stderr(&source_map); + if !args.no_warnings { + for warning in &result.warnings { + warning.fancy_format_stderr(&source_map); + } } if let Some(value) = result.value.as_ref() { -- cgit 1.4.1