std.env.variables
Show source codeHide source code
fn pub variables -> Map[String, String] {
let vars = Map.new
let mut idx = 0
let len = inko_env_size(_INKO.state) as Int
while idx < len {
let key = String.from_borrowed_primitive(inko_env_get_key(_INKO.state, idx))
match get(key) {
case Ok(val) -> {
vars.set(key, val)
nil
}
case _ -> {}
}
idx += 1
}
vars
}
fn pub static variables -> Map[String, String]
Returns all defined environment variables and their values.
Examples
Obtaining all environment variables and their values:
import std.env
env.variables.get('HOME') # => Result.Ok('/home/alice')