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 bbdac57426
commit 02889048ca
No known key found for this signature in database
GPG Key ID: 1BA2A0CC7C22B854
1 changed files with 5 additions and 2 deletions

View File

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