package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0.std/B0_std/Os/Env/index.html
Module Os.Env
Environment variables.
Variables
find ~empty_is_none name
is the value of the environment variable name
in the current process environment, if defined. If empty_is_none
is true
, None
is returned if the variable value is the empty string.
val find' :
empty_is_none:bool ->
(string -> ('a, string) result) ->
string ->
('a option, string) result
find' ~empty_is_none parse name
is like find
but the value is parsed with parse
. If the latter errors with Error e
, Error (Fmt.str "%s env: %s" name e)
is returned.
Process environement
type t = string String.Map.t
The type for process environments.
val empty : t
empty
is String.Map.empty
.
add
is String.Map.add
.
Process environments as assignments
The type for environments as lists of strings of the form "var=value"
.
val current_assignments : unit -> (assignments, string) result
current_assignments ()
is the current process environment as assignments.
of_assignments ~init ss
folds over strings in ss
, cuts them at the leftmost '='
character and adds the resulting pair to init
(defaults to empty
). If the same variable is bound more than once, the last one takes over.
val to_assignments : t -> assignments
to_assignments env
is env
's bindings as assignments.