Skip to content

Commit 702c49a

Browse files
add --directory option (#104)
closes #73
1 parent bec1fb9 commit 702c49a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
- add `-d`, `--directory` options to set starting working directory
89

910
### Changed
1011
- 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))

src/main.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,26 @@ fn process_cmdline() -> Result<()> {
234234
.help("Stores logging output into a cache directory")
235235
.short("l")
236236
.long("logging"),
237+
)
238+
.arg(
239+
Arg::with_name("directory")
240+
.help("Set the working directory")
241+
.short("d")
242+
.long("directory")
243+
.takes_value(true),
237244
);
238245

239246
let arg_matches = app.get_matches();
240247
if arg_matches.is_present("logging") {
241248
setup_logging()?;
242249
}
243250

251+
if arg_matches.is_present("directory") {
252+
let directory =
253+
arg_matches.value_of("directory").unwrap_or(".");
254+
env::set_current_dir(directory)?;
255+
}
256+
244257
Ok(())
245258
}
246259

0 commit comments

Comments
 (0)