package opam-state

  1. Overview
  2. Docs

Process environment setup and handling, shell configuration

Environment handling

val get_full : ?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. If opamswitch, the OPAMSWITCH environment variable is included (default true).

val get_opam : 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.

val get_pure : unit -> OpamTypes.env

Returns the running environment, with any opam modifications cleaned out

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 is_up_to_date : 'a OpamStateTypes.switch_state -> bool

Check if the shell environment is in sync with the current OPAM switch

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

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 -> OpamTypes.switch option -> string

The shell command to run by the user to set his OPAM environment, adapted to the current environment (OPAMROOT, OPAMSWITCH variables) and 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 -> OpamTypes.dirname -> OpamTypes.switch -> OpamTypes.env

Returns the full environment with only the PATH variable updated, as per path

Shell and initialisation support

val setup_interactive : OpamTypes.dirname -> dot_profile:OpamTypes.filename -> OpamTypes.shell -> bool

Details the process to the user, and interactively update the global and user configurations. Returns true if the update was confirmed and successful

val display_setup : OpamTypes.dirname -> dot_profile:OpamTypes.filename -> OpamTypes.shell -> unit

Display the global and user configuration for OPAM.

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 -> unit

Write the generic scripts in ~/.opam/opam-init needed to import state for various shells

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)

OCaml

Innovation. Community. Security.