Module Conf.Bit
Configuration bits.
Bundles a cli interface and a configuration file lookup.
Note. For Cmdliner proper support we would likely hide it in Cmdliner terms and let them handle the merge logic. Though that poses a few problems with e.g. configuration error report/recovery. Another problem is the recursion between specifying the configuration file lookup on the cli itself while using it terms themselves. Also lazy absents.
Configuration bits
val with_cli_arg : ?docs:string -> ?docv:string -> string -> doc:string -> absent:'a -> conf:'a B0_serialk_sexp.Sexpq.t -> arg:(Cmdliner.Arg.info -> 'a option Cmdliner.Arg.t) -> 'a t
with_cli_arg n ~doc ~docs ~docv ~absent ~conf ~arg
is a configuration bit named byn
.arg
is used to parse the bit from the cli using an option argument namedn
documented withdoc
in sectiondocs
and metavariabledocv
.conf
is used to lookup the bit value in a configuration dictionary with an optional keyn
.absent
is used as a default value.
val with_cli : string -> absent:'a -> conf:'a B0_serialk_sexp.Sexpq.t -> cli:'a option Cmdliner.Term.t -> 'a t
with_cli n ~absent ~conf ~cli
is a configuration bit named byn
cli
is used to get the bit from the cli.conf
is used to lookup the bit value in a configuration dictionary with an optional keyn
.basent
is used as a default value.
val cli : 'a t -> 'a option Cmdliner.Term.t
cli b
is the command line interface forb
.
val conf : 'a t -> 'a B0_serialk_sexp.Sexpq.t
conf b
is the configuration key query forb
. If the key is not foundabsent
is returned.
val get : 'a t -> 'a option -> (B0_serialk_sexp.Sexp.t * B0_serialk_sexp.Sexpq.path) -> ('a, string) Stdlib.result
get b cli sexp
gets the configuration bit fromsexp
ifcli
isNone
. If it's not in the configuration thenabsent
is returned.
val append : 'a list t -> 'a list option -> (B0_serialk_sexp.Sexp.t * B0_serialk_sexp.Sexpq.path) -> ('a list, string) Stdlib.result
append b cli sexp
gets the configuration bit fromsexp
and appends them tocli
.