Skip to content

Commit

Permalink
add --directory option (closes gitui-org#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
alistaircarscadden committed Jun 2, 2020
1 parent b3ccdb5 commit 6b9f994
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,26 @@ fn process_cmdline() -> Result<()> {
.help("Stores logging output into a cache directory")
.short("l")
.long("logging"),
)
.arg(
Arg::with_name("directory")
.help("Set the working directory")
.short("d")
.long("directory")
.takes_value(true),
);

let arg_matches = app.get_matches();
if arg_matches.is_present("logging") {
setup_logging()?;
}

if arg_matches.is_present("directory") {
let directory =
arg_matches.value_of("directory").unwrap_or(".");
env::set_current_dir(directory)?;
}

Ok(())
}

Expand Down

0 comments on commit 6b9f994

Please sign in to comment.