Module B0.OS.Env

module Env: sig .. end
Environment variables.


Variables


val find : ?empty_is_absent:bool -> string -> string option
find ~empty_is_absent name is the value of the process environment variable name, if defined. If empty_is_absent is true (default), None is returned if the variable value is the empty string.
val get : ?empty_is_absent:bool -> string -> absent:string -> string
get ~empty_is_absent name ~absent is the value of the process environment variable environment variable name, if defined, and absent if undefined. If empty_is_absent is true (default) and the variable value is the empty string, absent is returned.
val value : ?empty_is_absent:bool -> string -> 'a B0.Conv.t -> absent:'a -> 'a B0.result
value ~empty_is_absent name conv ~absent is like B0.OS.Env.get except the variable value is parsed using conv's textual parser.
val get_value : ?log:B0.Log.level ->
?empty_is_absent:bool -> string -> 'a B0.Conv.t -> absent:'a -> 'a
value ~log ~empty_is_absent name conv ~absent is like B0.OS.Env.value except on parse errors, they are logged with level log (if any) and absent is returned. log defaults to Some Log.Error.

Process environement


type t = string B0.String.map 
The type for process environments.
val empty : t
empty is String.Map.empty.
val current : unit -> t B0.result
current () is the current process environment.
val override : t -> by:t -> t
override env ~by:o overrides the definitions in env by o.
val assignments : unit -> string list B0.result
assignements () is the current process environments as a list of strings of the form "var=value".
val of_assignments : ?init:t -> string list -> t B0.result
of_assignments ~init ss folds over strings in ss, cuts them at the first '=' character and adds the resulting pair to init (defaults to B0.OS.Env.empty). If the same variable is bound more than once, the last one takes over.
val to_assignments : t -> string list
to_assignments env is env's bindings as a list of strings of the form "var=value".