From 7f03296e78e127b0bd5e39cc8c5d82fbde7aa525 Mon Sep 17 00:00:00 2001 From: Joshua McKinnon Date: Thu, 4 Jul 2024 10:56:45 -0700 Subject: [PATCH] Recognize ./scripts as a script directory --- crates/lune/src/cli/utils/files.rs | 8 +++++--- crates/lune/src/cli/utils/listing.rs | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/lune/src/cli/utils/files.rs b/crates/lune/src/cli/utils/files.rs index 2e02bb8..333f23a 100644 --- a/crates/lune/src/cli/utils/files.rs +++ b/crates/lune/src/cli/utils/files.rs @@ -127,10 +127,11 @@ pub fn discover_script_path(path: impl AsRef, in_home_dir: bool) -> Result< /** Discovers a script file path based on a given script name, and tries to - find scripts in `lune` and `.lune` folders if one was not directly found. + find scripts in `lune`, `.lune` and `scripts` folders if one was not + directly found. - Note that looking in `lune` and `.lune` folders is automatically - disabled if the given script name is an absolute path. + Note that looking in `lune`, `scripts` and `.lune` folders is + automatically disabled if the given script name is an absolute path. Behavior is otherwise exactly the same as for `discover_script_file_path`. */ @@ -148,6 +149,7 @@ pub fn discover_script_path_including_lune_dirs(path: &str) -> Result { // directories + the home directory for the current user let res = discover_script_path(format!("lune{MAIN_SEPARATOR}{path}"), false) .or_else(|_| discover_script_path(format!(".lune{MAIN_SEPARATOR}{path}"), false)) + .or_else(|_| discover_script_path(format!("scripts{MAIN_SEPARATOR}{path}"), false)) .or_else(|_| discover_script_path(format!("lune{MAIN_SEPARATOR}{path}"), true)) .or_else(|_| discover_script_path(format!(".lune{MAIN_SEPARATOR}{path}"), true)); diff --git a/crates/lune/src/cli/utils/listing.rs b/crates/lune/src/cli/utils/listing.rs index 4145376..411fa5d 100644 --- a/crates/lune/src/cli/utils/listing.rs +++ b/crates/lune/src/cli/utils/listing.rs @@ -23,6 +23,9 @@ pub async fn find_lune_scripts(in_home_dir: bool) -> Result { let mut files = Vec::new();