From 66da21c53f30af239b193ea4372e650d720e6c30 Mon Sep 17 00:00:00 2001 From: Roland Schaer Date: Mon, 10 Jun 2024 07:18:51 +0200 Subject: [PATCH] fix: group prefix not applied for script tasks (#2273) --- src/cli/run.rs | 2 +- src/task.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cli/run.rs b/src/cli/run.rs index cb10d60823..ab07a443e4 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -47,7 +47,7 @@ use super::args::ToolArg; /// outputs = ["dist/**/*.js"] /// /// Alternatively, tasks can be defined as standalone scripts. -/// These must be located in the `.mise/tasks` directory. +/// These must be located in the `.mise/tasks`, `mise/tasks` or `.config/mise/tasks` directory. /// The name of the script will be the name of the tasks. /// /// $ cat .mise/tasks/build<, path: impl AsRef) -> Result p.strip_prefix(".mise/tasks"), + p if p.starts_with("mise/tasks") => p.strip_prefix("mise/tasks"), p if p.starts_with(".config/mise/tasks") => p.strip_prefix(".config/mise/tasks"), _ => Ok(p), })?? @@ -338,6 +339,10 @@ fn config_root(config_source: &impl AsRef) -> Option<&Path> { if ancestor.ends_with(".config/mise/tasks") { return ancestor.parent()?.parent()?.parent(); } + + if ancestor.ends_with("mise/tasks") { + return ancestor.parent()?.parent(); + } } config_source.as_ref().parent() @@ -424,6 +429,7 @@ mod tests { ("/base", Some(Path::new("/"))), ("/base/.mise/tasks", Some(Path::new("/base"))), ("/base/.config/mise/tasks", Some(Path::new("/base"))), + ("/base/mise/tasks", Some(Path::new("/base"))), ]; for (src, expected) in test_cases {