package opam-state

  1. Overview
  2. Docs

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

type 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. external_tags : string list;
  7. keep_build_dir : bool;
  8. reuse_build_dir : bool;
  9. inplace_build : bool;
  10. no_base_packages : bool;
  11. build_test : bool;
  12. build_doc : bool;
  13. show : bool;
  14. dryrun : bool;
  15. fake : bool;
  16. makecmd : string Lazy.t;
  17. json_out : string option;
}
type '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 -> ?external_tags:string list -> ?keep_build_dir:bool -> ?reuse_build_dir:bool -> ?inplace_build:bool -> ?no_base_packages:bool -> ?build_test:bool -> ?build_doc:bool -> ?show:bool -> ?dryrun:bool -> ?fake:bool -> ?makecmd:string Lazy.t -> ?json_out:string option -> 'a
include OpamStd.Config.Sig with type t := t and type 'a options_fun := 'a options_fun
val default : t

The default values of the options to use at startup

val set : t -> (unit -> t) options_fun

Use to update any option in a t, using the optional arguments of options_fun. E.g. set opts ?option1:1 ?option4:"x" ()

val setk : (t -> 'a) -> t -> 'a options_fun

Same as set, but passes the result to a continuation, allowing argument stacking

The global reference containing the currently set library options. Access using OpamXxxConfig.(!r.field).

val update : ?noop:_ -> (unit -> unit) options_fun

Updates the currently set options in r according to the optional arguments

val init : ?noop:_ -> (unit -> unit) options_fun

Sets the options, reading the environment to get default values when unspecified

val initk : 'a -> 'a options_fun

Sets the options like init, but returns the given value (for arguments stacking)

val opamroot : ?root_dir:OpamTypes.dirname -> unit -> OpamTypes.dirname

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

Loads the global configuration file, protecting against concurrent writes

val 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

val get_switch : unit -> OpamTypes.switch

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

val 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

OCaml

Innovation. Community. Security.