Skip to main content

bool_from_env

Function bool_from_env 

Source
pub fn bool_from_env(var: &str, default: bool) -> bool
Expand description

Read a boolean from an environment variable.

Accepted truthy values: 1, true, yes, on Accepted falsy values: 0, false, no, off Any other value or unset variable returns the default.

ยงExample

use agentic_tools_utils::cli::bool_from_env;

// Returns default when var is not set
let value = bool_from_env("NONEXISTENT_VAR_12345", true);
assert!(value);