package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.std/B0_std/Os/Env/index.html
Module Os.Env
Source
Environment variables.
Note. On Windows environment variable names are case insensitive. All the operations performed by this module take this into account when Sys.win32
is true
. Be careful if you deal with Env.assignments
directly.
Variables
The type for environment variable names. Case insensitive on Windows.
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) result) ->
var_name ->
('a option, string) 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.
Process environement
The type for process environments.
override env ~by:over
overrides the definitions in env
by those in by
.
fold f env init
folds f
on env
's bindings starting with init
.
Process environments as assignments
The type for environments as lists of strings of the form "VAR=value"
.
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.
to_assignments env
is env
's bindings as assignments.
pp
formats assignments for inspection.