Allow 'Justfile' in addition to 'justfile'

This commit is contained in:
Casey Rodarmor 2016-09-27 23:25:06 -07:00
parent 696fd3a5f1
commit 10e1ef4f0f

View File

@ -72,12 +72,22 @@ fn main() {
Some(make) => make, Some(make) => make,
}; };
let mut justfile = "justfile";
loop { loop {
match std::fs::metadata("justfile") { match std::fs::metadata("justfile") {
Ok(metadata) => if metadata.is_file() { break; }, Ok(metadata) => if metadata.is_file() { break; },
Err(error) => die!("Error fetching justfile metadata: {}", error), 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() { match std::env::current_dir() {
Ok(pathbuf) => if pathbuf.as_os_str() == "/" { die!("No justfile found"); }, Ok(pathbuf) => if pathbuf.as_os_str() == "/" { die!("No justfile found"); },
Err(error) => die!("Error getting current dir: {}", error), Err(error) => die!("Error getting current dir: {}", error),
@ -103,7 +113,7 @@ fn main() {
command.arg("--always-make").arg("--no-print-directory"); command.arg("--always-make").arg("--no-print-directory");
} }
command.arg("-f").arg("justfile"); command.arg("-f").arg(justfile);
for recipe in recipes { for recipe in recipes {
command.arg(recipe); command.arg(recipe);