From e1b1b48840b8c96e45a567a47922138544ab9f59 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Sun, 24 Nov 2024 20:28:09 -0600 Subject: [PATCH] fix: show more accurate error if no tasks are available --- src/cli/run.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cli/run.rs b/src/cli/run.rs index ca13cf6b0a..124d0037db 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -675,6 +675,12 @@ impl Run { } fn err_no_task(&self, name: &str) -> Result<()> { + if CONFIG.tasks().is_ok_and(|t| t.is_empty()) { + bail!( + "no tasks defined in {}. Are you in a project directory?", + display_path(dirs::CWD.clone().unwrap_or_default()) + ); + } if let Some(cwd) = &*dirs::CWD { let includes = CONFIG.task_includes_for_dir(cwd); let path = includes