aboutsummaryrefslogtreecommitdiff
path: root/lib/naming/config.mli
blob: 41ff429a2efdb8d2e5f4392115f0d0cdbca164d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(** The config file: what the user wants by default, and where each value came
    from.

    Owns precedence and provenance and nothing else. Never reads the filesystem
    -- callers hand it text -- so it is as testable as the language table.

    A config file is OPTIONAL. With none, colitur behaves exactly as it does
    without this feature, except that names resolve through the default
    language. *)

type t

val empty : t
val of_string : string -> (t, string) result

val lang : t -> string option
val overlays : t -> string list
val template : t -> string option
val format : t -> string option

(** Keys present in the file that this build does not understand. Reported, never
    fatal: a config written for a newer colitur must still work on an older one,
    but silently ignoring a line the user wrote is how a typo becomes invisible. *)
val unknown_keys : t -> string list

(** [resolve ~flag ~config ~default] returns [(value, source)] with source one of
    ["flag"], ["config"], ["default"]. Precedence is flag > config > default. *)
val resolve : flag:string option -> config:string option -> default:string -> string * string