Library
Module
Module type
Parameter
Class
Class type
Process environment setup and handling, shell configuration
val get_full :
?set_opamroot:bool ->
?set_opamswitch:bool ->
force_path:bool ->
?updates:OpamTypes.env_update list ->
'a OpamStateTypes.switch_state ->
OpamTypes.env
Get the current environment with OPAM specific additions. If force_path
, the PATH is modified to ensure opam dirs are leading. set_opamroot
and set_opamswitch
can be additionally used to set the OPAMROOT
and OPAMSWITCH
variables.
val get_opam :
?set_opamroot:bool ->
?set_opamswitch:bool ->
force_path:bool ->
'a OpamStateTypes.switch_state ->
OpamTypes.env
Get only environment modified by OPAM. If force_path
, the PATH is modified to ensure opam dirs are leading. set_opamroot
and set_opamswitch
can be additionally used to set the OPAMROOT
and OPAMSWITCH
variables.
val get_opam_raw :
?set_opamroot:bool ->
?set_opamswitch:bool ->
force_path:bool ->
OpamTypes.dirname ->
OpamTypes.switch ->
OpamTypes.env
Like get_opam
, but reads the cache file from the given opam root and switch instead of computing the environment from a switch state
val get_pure : ?updates:OpamTypes.env_update list -> unit -> OpamTypes.env
Returns the running environment, with any opam modifications cleaned out, and optionally the given updates
val add : OpamTypes.env -> OpamTypes.env_update list -> OpamTypes.env
Update an environment, including reverting opam changes that could have been previously applied (therefore, don't apply to an already updated env as returned by e.g. get_full
!)
val updates :
?set_opamroot:bool ->
?set_opamswitch:bool ->
?force_path:bool ->
'a OpamStateTypes.switch_state ->
OpamTypes.env_update list
Like get_opam
computes environment modification by OPAM , but returns these updates
instead of the new environment.
val is_up_to_date : 'a OpamStateTypes.switch_state -> bool
Check if the shell environment is in sync with the current OPAM switch (or if OPAMNOENVNOTICE has been set, in which case we just assume it's up to date)
val is_up_to_date_switch : OpamTypes.dirname -> OpamTypes.switch -> bool
Check if the shell environment is in sync with the given opam root and switch (or if OPAMNOENVNOTICE has been set, in which case we just assume it's up to date)
val compute_updates :
?force_path:bool ->
'a OpamStateTypes.switch_state ->
OpamTypes.env_update list
Returns the current environment updates to configure the current switch with its set of installed packages
val eval_string :
'a OpamStateTypes.global_state ->
?set_opamswitch:bool ->
OpamTypes.switch option ->
string
The shell command to run by the user to set his OPAM environment, adapted to the current shell (as returned by eval `opam config env`
)
val path : force_path:bool -> OpamTypes.dirname -> OpamTypes.switch -> string
Returns the updated contents of the PATH variable for the given opam root and switch (set force_path
to ensure the opam path is leading)
val full_with_path :
force_path:bool ->
?updates:OpamTypes.env_update list ->
OpamTypes.dirname ->
OpamTypes.switch ->
OpamTypes.env
Returns the full environment with only the PATH variable updated, as per path
val setup :
OpamTypes.dirname ->
interactive:bool ->
?dot_profile:OpamTypes.filename ->
?update_config:bool ->
?env_hook:bool ->
?completion:bool ->
OpamTypes.shell ->
unit
Sets the opam configuration in the user shell, after detailing the process and asking the user if either update_config
or shell_hook
are unset
val update_user_setup :
OpamTypes.dirname ->
?dot_profile:OpamTypes.filename ->
OpamTypes.shell ->
unit
Update the user configuration in $HOME for good opam integration.
val write_static_init_scripts :
OpamTypes.dirname ->
?completion:bool ->
?env_hook:bool ->
unit ->
unit
Write the generic scripts in ~/.opam/opam-init needed to import state for various shells. If specified, completion and env_hook files can also be written or removed (the default is to keep them as they are)
val write_custom_init_scripts :
OpamTypes.dirname ->
(string * string) list ->
unit
Write into OpamPath.hooks_dir
the given custom scripts (listed as (filename, content)), normally provided by opamrc (OpamFile.InitConfig
)
val write_dynamic_init_scripts : 'a OpamStateTypes.switch_state -> unit
Update the shell scripts containing the current switch configuration in ~/.opam/opam-init ; prints a warning and skips if a write lock on the global state can't be acquired (note: it would be better to acquire a write lock beforehand, but only when working on the switch selected in ~/.opam/config)
val clear_dynamic_init_scripts :
OpamStateTypes.rw OpamStateTypes.global_state ->
unit
Removes the dynamic init scripts setting the variables for any given switch.
val check_and_print_env_warning : 'a OpamStateTypes.switch_state -> unit
Print a warning if the environment is not set-up properly. (General message)