Changed to unwrap methods, added integration tests

This commit is contained in:
Ricky authored and David Peter committed 2018-11-04 11:19:49 +01:00
1 parent 1dd57e6d7e
commit 558134f6c8
3 files changed
+37 -11

No files matched your search

+5 -11
View File
@@ -9,17 +9,11 @@ use dirs::PROJECT_DIRS;
use util::transpose;
pub fn config_file() -> PathBuf {
match env::var("BAT_CONFIG_PATH") {
Ok(env_path) => {
let env_path_buf = PathBuf::from(env_path);
if env_path_buf.is_file() {
return env_path_buf;
} else {
return PROJECT_DIRS.config_dir().join("config");
}
}
Err(_) => PROJECT_DIRS.config_dir().join("config"),
}
env::var("BAT_CONFIG_PATH")
.ok()
.map(PathBuf::from)
.filter(|config_path| config_path.is_file())
.unwrap_or(PROJECT_DIRS.config_dir().join("config"))
}
pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {