package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dadde8cfa62be9dabd805fc190b415427b4699ffe3458c153e2f3f9cc5c9b9b4
md5=f96ac96fb0182f2b97dbe9ded452544b
doc/b0.std/B0_std/Os/Env/index.html
Module Os.Env
Environment variables.
Variables
find ~empty_to_none name
is the value of the environment variable name
in the current process environment, if defined. If empty_to_none
is true
(default), None
is returned if the variable value is the empty string.
val find_value :
(string -> ('a, string) result) ->
empty_to_none:bool ->
string ->
('a, string) result option
find_value parse ~empty_to_none name
is Option.bind parse (find ~empty_to_none name)
, except the error message of parse
is tweaked to mention name
in case of error.
Process environement
type t = string String.Map.t
The type for process environments.
val empty : t
empty
is String.Map.empty
.
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.