| 1 |
(**************************************************************************) |
| 2 |
(* *) |
| 3 |
(* Copyright 2015-2018 OCamlPro *) |
| 4 |
(* *) |
| 5 |
(* All rights reserved. This file is distributed under the terms of the *) |
| 6 |
(* GNU Lesser General Public License version 2.1, with the special *) |
| 7 |
(* exception on linking described in the file LICENSE. *) |
| 8 |
(* *) |
| 9 |
(**************************************************************************) |
| 10 |
|
| 11 |
(** Configuration options for the core lib (record, global reference and |
| 12 |
setter) *) |
| 13 |
|
| 14 |
module E : sig |
| 15 |
type OpamStd.Config.E.t += |
| 16 |
| COLOR of OpamStd.Config.when_ option |
| 17 |
| CONFIRMLEVEL of OpamStd.Config.answer option |
| 18 |
| DEBUG of int option |
| 19 |
| DEBUGSECTIONS of OpamStd.Config.sections option |
| 20 |
| ERRLOGLEN of int option |
| 21 |
| KEEPLOGS of bool option |
| 22 |
| LOGS of string option |
| 23 |
| MERGEOUT of bool option |
| 24 |
| NO of bool option |
| 25 |
| PRECISETRACKING of bool option |
| 26 |
| SAFE of bool option |
| 27 |
| STATUSLINE of OpamStd.Config.when_ option |
| 28 |
| UTF8 of OpamStd.Config.when_ext option |
| 29 |
| UTF8MSGS of bool option |
| 30 |
| VERBOSE of OpamStd.Config.level option |
| 31 |
| YES of bool option |
| 32 |
|
| 33 |
val confirmlevel: unit -> OpamStd.Config.answer option |
| 34 |
val debug: unit -> int option |
| 35 |
val logs: unit -> string option |
| 36 |
val yes: unit -> bool option |
| 37 |
end |
| 38 |
|
| 39 |
type t = private { |
| 40 |
debug_level : int; |
| 41 |
(** Controls debug messages, 0 to disable *) |
| 42 |
debug_sections : OpamStd.Config.sections; |
| 43 |
(** Controls which sections display debugging messages. If empty, all messages |
| 44 |
are displayed. *) |
| 45 |
verbose_level : OpamStd.Config.level; |
| 46 |
(** Controls printing of external commands and output, 0 to disable, more |
| 47 |
means print more low-level commands *) |
| 48 |
color : OpamStd.Config.when_; |
| 49 |
(** Console ANSI color control *) |
| 50 |
utf8 : OpamStd.Config.when_ext; |
| 51 |
(** Controls usage of UTF8 in OPAM-generated messages. Extended adds camel |
| 52 |
emojis *) |
| 53 |
disp_status_line: OpamStd.Config.when_; |
| 54 |
(** Controls on-line display of parallel commands being run, using ANSI |
| 55 |
escapes *) |
| 56 |
confirm_level : [ OpamStd.Config.answer | `undefined ]; |
| 57 |
yes: bool option; |
| 58 |
(** Affects interactive questions in OpamConsole: used to compute the |
| 59 |
automatic ansering level *) |
| 60 |
safe_mode : bool; |
| 61 |
(** Fail on writes or delays, don't ask questions (for quick queries, e.g. |
| 62 |
for shell completion) *) |
| 63 |
log_dir : string; |
| 64 |
(** Where to store log and temporary files (output from commands...) *) |
| 65 |
keep_log_dir : bool; |
| 66 |
(** Whether to cleanup temporary and log files on exit *) |
| 67 |
errlog_length : int; |
| 68 |
(** The number of log lines displayed on process error. 0 for all *) |
| 69 |
merged_output : bool; |
| 70 |
(** If set, stderr of commands is merged into their stdout *) |
| 71 |
precise_tracking : bool; |
| 72 |
(** If set, will take full md5 of all files when checking diffs (to track |
| 73 |
installations), rather than rely on just file size and mtime *) |
| 74 |
cygbin: string option; |
| 75 |
set : bool; |
| 76 |
(** Options have not yet been initialised (i.e. defaults are active) *) |
| 77 |
} |
| 78 |
|
| 79 |
type 'a options_fun = |
| 80 |
?debug_level:int -> |
| 81 |
?debug_sections:OpamStd.Config.sections -> |
| 82 |
?verbose_level:OpamStd.Config.level -> |
| 83 |
?color:OpamStd.Config.when_ -> |
| 84 |
?utf8:OpamStd.Config.when_ext -> |
| 85 |
?disp_status_line:OpamStd.Config.when_ -> |
| 86 |
?confirm_level:OpamStd.Config.answer -> |
| 87 |
?yes:bool option -> |
| 88 |
?safe_mode:bool -> |
| 89 |
?log_dir:string -> |
| 90 |
?keep_log_dir:bool -> |
| 91 |
?errlog_length:int -> |
| 92 |
?merged_output:bool -> |
| 93 |
?precise_tracking:bool -> |
| 94 |
?cygbin:string -> |
| 95 |
'a |
| 96 |
|
| 97 |
val default : t |
| 98 |
|
| 99 |
val set : t -> (unit -> t) options_fun |
| 100 |
|
| 101 |
val setk : (t -> 'a) -> t -> 'a options_fun |
| 102 |
|
| 103 |
val r : t ref |
| 104 |
|
| 105 |
val update : ?noop:_ -> (unit -> unit) options_fun |
| 106 |
|
| 107 |
(** Sets the OpamCoreConfig options, reading the environment to get default |
| 108 |
values when unspecified *) |
| 109 |
val init: ?noop:_ -> (unit -> unit) options_fun |
| 110 |
|
| 111 |
(** Like [init], but returns the given value. For optional argument |
| 112 |
stacking *) |
| 113 |
val initk: 'a -> 'a options_fun |
| 114 |
|
| 115 |
(** Automatic answering levels |
| 116 |
* [`ask]: prompt and ask user |
| 117 |
* [`all_no]: answer no to all opam questions |
| 118 |
* [`all_yes]: answer yes to all opam questions |
| 119 |
* [`unsafe_yes]: answer yes to all opam question and launch system package |
| 120 |
command wit non interactive options |
| 121 |
If confirm-level is set (from cli or environment variable), its value is |
| 122 |
returned. Otherwise, is takes last yes/no cli flag. For environment |
| 123 |
variables, if [OPAMYES] is set to true, it has priority over [OPAMNO]. As |
| 124 |
other environment variables, cli flags content is taken if given. |
| 125 |
[answer_is] and [answer_is_yes] computes the answer lazily, use [answer] in |
| 126 |
case of config update. |
| 127 |
*) |
| 128 |
val answer_is: OpamStd.Config.answer -> bool |
| 129 |
val answer_is_yes : unit -> bool |
| 130 |
val answer: unit -> OpamStd.Config.answer |
| 131 |
|
| 132 |
(** [true] if OPAM was compiled in developer mode *) |
| 133 |
val developer : bool |