Skip to content

Commit

Permalink
add --directory option (#104)
Browse files Browse the repository at this point in the history
closes #73
  • Loading branch information
alistaircarscadden authored Jun 4, 2020
1 parent bec1fb9 commit 702c49a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- add `-d`, `--directory` options to set starting working directory

### Changed
- changed hotkeys for selecting stage/workdir (**[w] / [s]** now to change between workdir and stage) and added hotkeys (`[1234]`) to switch to tabs directly ([#92](https://github.com/extrawurst/gitui/issues/92))
Expand Down
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 702c49a

Please sign in to comment.