module Flag:sig
..end
type 'a
t
'a
val name : 'a t -> string
type('a, 'b)
create =string ->
?aliases:string list ->
?full_flag_required:bool -> 'b -> doc:string -> 'a t
val of_arg : Core.Std.Arg.t -> unit t
val noarg : (unit, unit -> unit) create
val string : (unit, string -> unit) create
val int : (unit, int -> unit) create
val float : (unit, float -> unit) create
val bool : (unit, bool -> unit) create
val gen : (string -> 'gen) -> (unit, 'gen -> unit) create
val set_string : (unit, string Pervasives.ref) create
val set_string_opt : (unit, string option Pervasives.ref) create
val set_int : (unit, int Pervasives.ref) create
val set_int_opt : (unit, int option Pervasives.ref) create
val set_float : (unit, float Pervasives.ref) create
val set_float_opt : (unit, float option Pervasives.ref) create
val set_date : (unit, Core.Date.t Pervasives.ref) create
val set_date_opt : (unit, Core.Date.t option Pervasives.ref) create
val set : (unit, bool Pervasives.ref) create
val clear : (unit, bool Pervasives.ref) create
val set_gen : (string -> 'gen) -> (unit, 'gen Pervasives.ref) create
val set_gen_opt : (string -> 'gen) -> (unit, 'gen option Pervasives.ref) create
val noarg_acc : ('a, 'a -> 'a) create
val string_acc : ('a, 'a -> string -> 'a) create
val int_acc : ('a, 'a -> int -> 'a) create
val bool_acc : ('a, 'a -> bool -> 'a) create
val float_acc : ('a, 'a -> float -> 'a) create
val date_acc : ('a, 'a -> Core.Date.t -> 'a) create
rest f
: a flag that signals the end of flag processing. all remaining arguments
are passed to the f
val rest_acc : ('a, 'a -> string list -> 'a) create
val gen_acc : (string -> 'gen) -> ('a, 'a -> 'gen -> 'a) create
val noarg_mut : ('a, 'a -> unit) create
val arg_mut : ('a, 'a -> string -> unit) create
val string_mut : ('a, 'a -> string -> unit) create
val int_mut : ('a, 'a -> int -> unit) create
val bool_mut : ('a, 'a -> bool -> unit) create
val float_mut : ('a, 'a -> float -> unit) create
val date_mut : ('a, 'a -> Core.Date.t -> unit) create
rest f
: a flag that signals the end of flag processing. all remaining arguments
are passed to the f
val rest_mut : ('a, 'a -> string list -> unit) create
val gen_mut : (string -> 'gen) -> ('a, 'a -> 'gen -> unit) create
module Action:sig
..end
val create : ?aliases:string list ->
?full_flag_required:bool ->
name:string -> doc:string -> 'a Action.t -> 'a t
val lift : 'a t -> project:('b -> 'a * ('a -> 'b)) -> 'b t
lift t ~project
transforms a flag with accumulator type 'a
into a flag with a more informative accumulator type 'b
provided that project x
returns a pair consisting of
1. a 'a
-value extracted from the 'b
-value x
, and
2. a function for rebuilding a modified 'b
-value from
the modified 'a
-value resulting from processing the flag.
The intended use pattern for lift
is when 'b
is a record type
with a field foo
of type 'a
and project
is
fun r -> (r.foo, (fun foo' -> { r with foo = foo' }))
val lift_unit : unit t -> 'any t