diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-14 00:20:28 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-14 00:20:28 -0600 |
commit | 744eac9b99270524a14691679f36e9518b85d0db (patch) | |
tree | 7d8097d12e79a81a887137715fb1516166db6303 /src/main.rs | |
parent | 14a06b875746c6366c161a70f5eacbc6843d339e (diff) | |
download | makers-744eac9b99270524a14691679f36e9518b85d0db.tar.gz makers-744eac9b99270524a14691679f36e9518b85d0db.zip |
add -C flag to change directory before starting
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index f0e0c1d..b43249d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ clippy::todo )] +use std::env; use std::fs::metadata; use std::io::stdin; use std::path::PathBuf; @@ -44,6 +45,9 @@ fn main() -> Result<()> { jane_eyre::install()?; let mut args = Args::from_env_and_args(); + if let Some(dir) = args.directory.as_ref() { + env::set_current_dir(dir)?; + } // If no makefile is specified, try some options. if args.makefile.is_empty() { let default_makefile = DEFAULT_PATHS.iter().find(|name| metadata(name).is_ok()); |