Join env var options with "=" instead of " "

Joining them with a space was causing certain styles (e.g. `-grid`) to
be misinterpreted as a separate option.
This commit is contained in:
Ethan P. 2024-04-06 17:05:46 -07:00
parent 6e91ba83b7
commit 93b25d75a0
No known key found for this signature in database
GPG Key ID: B29B90B1B228FEBC

View File

@ -146,8 +146,11 @@ pub fn get_args_from_env_vars() -> Vec<OsString> {
("--style", "BAT_STYLE"), ("--style", "BAT_STYLE"),
] ]
.iter() .iter()
.filter_map(|(flag, key)| env::var(key).ok().map(|var| [flag.to_string(), var])) .filter_map(|(flag, key)| {
.flatten() env::var(key)
.ok()
.map(|var| [flag.to_string(), var].join("="))
})
.map(|a| a.into()) .map(|a| a.into())
.collect() .collect()
} }