It's probably good to be consistent about what is recognized as "true" without copying the same code.
6 lines
210 B
Rust
6 lines
210 B
Rust
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
pub fn bool_var(name: &str) -> Option<bool> {
|
|
let value = std::env::var(name).ok()?.to_lowercase();
|
|
Some(["1", "true", "yes", "y"].contains(&value.as_str()))
|
|
}
|