about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-05-25T08·50+0300
committerclbot <clbot@tvl.fyi>2023-05-27T16·44+0000
commit93fa47f2ae868e9476f1dd33572022ef0bed4dbf (patch)
treefbb706a7115cb82ae044b81111fc3c382312838a /tvix
parentc7e7f6d682a3e45e41698f3f47ab9439b36145c3 (diff)
feat(tvix/cli): add --no-warnings argument r/6213
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 <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r--tvix/cli/src/main.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs
index c588472592cf..28b75dd907aa 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<String>,
@@ -126,8 +130,10 @@ fn interpret(code: &str, path: Option<PathBuf>, 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() {