From ba51949b518daaabdc0637ea0b081c24f0553096 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:49:46 -0600 Subject: [PATCH] feat: added quiet field to tasks (#3514) Fixes #2564 --- docs/tasks/toml-tasks.md | 2 +- src/cli/run.rs | 8 ++++---- src/task/mod.rs | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/tasks/toml-tasks.md b/docs/tasks/toml-tasks.md index 4a91a15b1..5947eb49a 100644 --- a/docs/tasks/toml-tasks.md +++ b/docs/tasks/toml-tasks.md @@ -349,7 +349,7 @@ run = 'echo "Enter your name:"; read name; echo "Hello, $name!"' ## quiet -Set `quiet = false` to supress mise additional output. +Set `quiet = true` to suppress mise additional output. ## Arguments diff --git a/src/cli/run.rs b/src/cli/run.rs index b36605901..dca155487 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -286,13 +286,13 @@ impl Run { fn run_task(&self, env: &BTreeMap, task: &Task) -> Result<()> { let prefix = task.estyled_prefix(); if SETTINGS.task_skip.contains(&task.name) { - if !self.quiet { + if !self.quiet && !task.quiet { eprintln!("{prefix} skipping task"); } return Ok(()); } if !self.force && self.sources_are_fresh(task)? { - if !self.quiet { + if !self.quiet && !task.quiet { eprintln!("{prefix} sources up-to-date, skipping"); } return Ok(()); @@ -368,7 +368,7 @@ impl Run { .bright() .to_string(), ); - if !self.quiet { + if !self.quiet && !task.quiet { eprintln!("{prefix} {cmd}"); } @@ -467,7 +467,7 @@ impl Run { let cmd = format!("{} {}", display_path(file), args.join(" ")); let cmd = trunc(&style::ebold(format!("$ {cmd}")).bright().to_string()); - if !self.quiet { + if !self.quiet && !task.quiet { eprintln!("{prefix} {cmd}"); } diff --git a/src/task/mod.rs b/src/task/mod.rs index 11fe6085a..5309bf312 100644 --- a/src/task/mod.rs +++ b/src/task/mod.rs @@ -64,6 +64,8 @@ pub struct Task { pub outputs: Vec, #[serde(default)] pub shell: Option, + #[serde(default)] + pub quiet: bool, // normal type #[serde(default, deserialize_with = "deserialize_arr")] @@ -414,6 +416,7 @@ impl Default for Task { run_windows: vec![], args: vec![], file: None, + quiet: false, } } }