This commit is contained in:
parent
1de1dd56de
commit
2cd133b9fb
23
src/main.rs
23
src/main.rs
@ -26,18 +26,27 @@ fn get_config_file_path(dir: &Path, config_path: &Path) -> (PathBuf, PathBuf) {
|
|||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// if we got here we found root_dir so config file should exist so we can unwrap safely
|
// if we got here we found root_dir so config file should exist so we could theoretically unwrap safely
|
||||||
let config_file = root_dir
|
let config_file_uncanonicalized = root_dir.join(config_path);
|
||||||
.join(config_path)
|
let config_file = config_file_uncanonicalized.canonicalize().unwrap_or_else(|e| {
|
||||||
.canonicalize()
|
messages::unravel_errors(
|
||||||
.unwrap_or_else(|_| panic!("could not find directory containing config file"));
|
&format!("Could not find canonical path of {}", config_file_uncanonicalized.display()),
|
||||||
|
&e.into(),
|
||||||
|
);
|
||||||
|
std::process::exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
(root_dir.to_path_buf(), config_file)
|
(root_dir.to_path_buf(), config_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
let cli_dir: PathBuf = cli.root.canonicalize().unwrap_or_else(|_| {
|
let cli_dir: PathBuf = cli.root.canonicalize().unwrap_or_else(|e| {
|
||||||
panic!("Could not find canonical path of root dir: {}", cli.root.display())
|
messages::unravel_errors(
|
||||||
|
&format!("Could not find canonical path of root dir: {}", cli.root.display()),
|
||||||
|
&e.into(),
|
||||||
|
);
|
||||||
|
std::process::exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
match cli.command {
|
match cli.command {
|
||||||
|
Loading…
Reference in New Issue
Block a user