Skip to content

Commit

Permalink
feat: added task_skip setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Nov 22, 2024
1 parent 5aa4a8e commit 475aa3c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
12 changes: 12 additions & 0 deletions e2e/tasks/test_task_skip
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

cat <<EOF >mise.toml
tasks.a = "echo running a"
tasks.b = "echo running b"
tasks.c = "echo running c"
tasks.all.run = "echo testing!"
tasks.all.depends = ["a", "b", "c"]
EOF

assert_contains "mise run all" "running b"
MISE_TASK_SKIP=b assert_not_contains "mise run all" "running b"
8 changes: 8 additions & 0 deletions settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,14 @@ docs = """
Change output style when executing tasks. This controls the output of `mise run`.
"""

[task_skip]
env = "MISE_TASK_SKIP"
type = "ListString"
rust_type = "BTreeSet<String>"
default = []
parse_env = "list_by_comma"
description = "Tasks to skip when running `mise run`."

[task_timings]
env = "MISE_TASK_TIMINGS"
type = "Bool"
Expand Down
6 changes: 5 additions & 1 deletion src/cli/render_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ impl RenderHelp {
xx::file::mkdirp("docs/.vitepress")?;

file::write("docs/.vitepress/cli_commands.ts", render_command_ts())?;
cmd!("prettier", "--write", "docs/.vitepress/cli_commands.ts").run()?;
if cfg!(windows) {
cmd!("prettier.cmd", "--write", "docs/.vitepress/cli_commands.ts").run()?;
} else {
cmd!("prettier", "--write", "docs/.vitepress/cli_commands.ts").run()?;
}
Ok(())
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ 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) {
eprintln!("{prefix} skipping task");
return Ok(());
}
if !self.force && self.sources_are_fresh(task)? {
eprintln!("{prefix} sources up-to-date, skipping");
return Ok(());
Expand Down

0 comments on commit 475aa3c

Please sign in to comment.