mirror of
https://github.com/jht5945/rust_util.git
synced 2025-12-27 07:30:05 +08:00
add util_env
This commit is contained in:
@@ -6,6 +6,7 @@ use std::{
|
||||
|
||||
pub mod util_io;
|
||||
pub mod util_os;
|
||||
pub mod util_env;
|
||||
pub mod util_cmd;
|
||||
pub mod util_msg;
|
||||
pub mod util_size;
|
||||
|
||||
9
src/util_env.rs
Normal file
9
src/util_env.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
use std::env;
|
||||
|
||||
pub fn is_env_on(var: &str) -> bool {
|
||||
match env::var(var) {
|
||||
Err(_) => false,
|
||||
Ok(v) => (v == "TRUE" || v == "true" || v =="YES" || v == "yes" || v == "1"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user