package opam-state

  1. Overview
  2. Docs

Module OpamStateConfigSource

Configuration options for the state lib (record, global reference, setter, initialisation)

Sourcetype t = private {
  1. root_dir : OpamFilename.Dir.t;
  2. current_switch : OpamSwitch.t option;
  3. switch_from : [ `Env | `Command_line | `Default ];
  4. jobs : int Lazy.t;
  5. dl_jobs : int;
  6. build_test : bool;
  7. build_doc : bool;
  8. dryrun : bool;
  9. makecmd : string Lazy.t;
  10. ignore_constraints_on : OpamTypes.name_set;
  11. unlock_base : bool;
  12. no_env_notice : bool;
  13. locked : string option;
}
Sourcetype 'a options_fun = ?root_dir:OpamFilename.Dir.t -> ?current_switch:OpamSwitch.t -> ?switch_from:[ `Env | `Command_line | `Default ] -> ?jobs:int Lazy.t -> ?dl_jobs:int -> ?build_test:bool -> ?build_doc:bool -> ?dryrun:bool -> ?makecmd:string Lazy.t -> ?ignore_constraints_on:OpamTypes.name_set -> ?unlock_base:bool -> ?no_env_notice:bool -> ?locked:string option -> 'a
include OpamStd.Config.Sig with type t := t and type 'a options_fun := 'a options_fun
Sourceval default : t
Sourceval set : t -> (unit -> t) options_fun
Sourceval setk : (t -> 'a) -> t -> 'a options_fun
Sourceval r : t ref
Sourceval update : ?noop:'a -> (unit -> unit) options_fun
Sourceval init : ?noop:'a -> (unit -> unit) options_fun
Sourceval initk : 'a -> 'a options_fun
Sourceval opamroot : ?root_dir:OpamTypes.dirname -> unit -> OpamTypes.dirname

Get the initial opam root value (from default, env or optional argument). This allows one to get it before doing the init, which is useful to get the configuration file used to fill some options to init()

Sourceval load : OpamTypes.dirname -> OpamFile.Config.t option

Loads the global configuration file, protecting against concurrent writes

Sourceval load_defaults : OpamFilename.Dir.t -> OpamFile.Config.t option

Loads the config file from the OPAM root and updates default values for all related OpamXxxConfig modules. Doesn't read the env yet, the init functions should still be called afterwards. OpamFormat should be initialised beforehand, as it may impact the config file loading.

Returns the config file that was found, if any

Sourceval get_switch : unit -> OpamTypes.switch

Returns the current switch, failing with an error message is none is set.

Sourceval get_switch_opt : unit -> OpamTypes.switch option

Returns the current switch, if any is set.

Sourceval get_current_switch_from_cwd : OpamFilename.Dir.t -> OpamTypes.switch option

The function used to locate an external switch from parents of the current directory. Takes the opam root as parameter, and rejects any external switch configured with a different root

Sourceval local_switch_exists : OpamFilename.Dir.t -> OpamTypes.switch -> bool

Checks if a local switch exists and is configurade for the given root

Sourceval resolve_local_switch : OpamFilename.Dir.t -> OpamTypes.switch -> OpamTypes.switch

Resolves the switch if it is a link to a global switch in the given root (return unchanged otherwise)

OCaml

Innovation. Community. Security.