From 10e1ef4f0fb6ad4b20a5038650019bcd475debc2 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 27 Sep 2016 23:25:06 -0700 Subject: [PATCH] Allow 'Justfile' in addition to 'justfile' --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2ecefb5..97a8c2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,12 +72,22 @@ fn main() { Some(make) => make, }; + let mut justfile = "justfile"; + loop { match std::fs::metadata("justfile") { Ok(metadata) => if metadata.is_file() { break; }, Err(error) => die!("Error fetching justfile metadata: {}", error), } + match std::fs::metadata("Justfile") { + Ok(metadata) => if metadata.is_file() { + justfile = "Justfile"; + break; + }, + Err(error) => die!("Error fetching justfile metadata: {}", error), + } + match std::env::current_dir() { Ok(pathbuf) => if pathbuf.as_os_str() == "/" { die!("No justfile found"); }, Err(error) => die!("Error getting current dir: {}", error), @@ -103,7 +113,7 @@ fn main() { command.arg("--always-make").arg("--no-print-directory"); } - command.arg("-f").arg("justfile"); + command.arg("-f").arg(justfile); for recipe in recipes { command.arg(recipe);