cosmic-comp/src/utils/env.rs
Ian Douglas Scott 087be20365 Add util function for boolean env vars
It's probably good to be consistent about what is recognized as "true"
without copying the same code.
2024-10-15 11:45:46 +02:00

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()))
}