Module Os.Env
Environment variables.
Variables
val find : empty_to_none:bool -> string -> string optionfind ~empty_to_none nameis the value of the environment variablenamein the current process environment, if defined. Ifempty_to_noneistrue(default),Noneis returned if the variable value is the empty string.
val find_value : (string -> ('a, string) Stdlib.result) -> empty_to_none:bool -> string -> ('a, string) Stdlib.result optionfind_value parse ~empty_to_none nameisOption.bind parse (find ~empty_to_none name), except the error message ofparseis tweaked to mentionnamein case of error.
Process environement
type t= string String.Map.tThe type for process environments.
val empty : temptyisString.Map.empty.
val current : unit -> (t, string) Stdlib.resultcurrent ()is the current process environment.
Process environments as assignments
type assignments= string listThe type for environments as lists of strings of the form
"var=value".
val current_assignments : unit -> (assignments, string) Stdlib.resultcurrent_assignments ()is the current process environment as assignments.
val of_assignments : ?init:t -> string list -> (t, string) Stdlib.resultof_assignments ~init ssfolds over strings inss, cuts them at the leftmost'='character and adds the resulting pair toinit(defaults toempty). If the same variable is bound more than once, the last one takes over.
val to_assignments : t -> assignmentsto_assignments envisenv's bindings as assignments.