Os.Env
Environment variables.
val var : empty_is_none:bool -> var_name -> string option
var ~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 var' :
empty_is_none:bool ->
(var_name -> ('a, string) Stdlib.result) ->
var_name ->
('a option, string) Stdlib.result
var' ~empty_is_none parse name
is like var
but the value is parsed with parse
. If the latter errors with Error e
, Error (Fmt.str "%s env: %s" name e)
is returned.
val empty : t
empty
is an empty environment.
val current : unit -> (t, string) Stdlib.result
current ()
is the current process environment.
fold f env init
folds f
on env
's bindings starting with env
.
The type for environments as lists of strings of the form "var=value"
.
val current_assignments : unit -> (assignments, string) Stdlib.result
current_assignments ()
is the current process environment as assignments.
val to_assignments : t -> assignments
to_assignments env
is env
's bindings as assignments.
val pp_assignments : assignments Fmt.t
pp
formats assignments for inspection.