Skip to content

Commit

Permalink
feat: added quiet field to tasks (#3514)
Browse files Browse the repository at this point in the history
Fixes #2564
  • Loading branch information
jdx authored Dec 13, 2024
1 parent 1984e66 commit ba51949
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/tasks/toml-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ impl Run {
fn run_task(&self, env: &BTreeMap<String, String>, 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(());
Expand Down Expand Up @@ -368,7 +368,7 @@ impl Run {
.bright()
.to_string(),
);
if !self.quiet {
if !self.quiet && !task.quiet {
eprintln!("{prefix} {cmd}");
}

Expand Down Expand Up @@ -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}");
}

Expand Down
3 changes: 3 additions & 0 deletions src/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ pub struct Task {
pub outputs: Vec<String>,
#[serde(default)]
pub shell: Option<String>,
#[serde(default)]
pub quiet: bool,

// normal type
#[serde(default, deserialize_with = "deserialize_arr")]
Expand Down Expand Up @@ -414,6 +416,7 @@ impl Default for Task {
run_windows: vec![],
args: vec![],
file: None,
quiet: false,
}
}
}
Expand Down

0 comments on commit ba51949

Please sign in to comment.