Up

Module type S

Signature

type +'a t
include Core_kernel.Std.Applicative.S with type 'a t := 'a t
type 'a t
val return : 'a -> 'a t
val apply : ('a -> 'b) t -> 'a t -> 'b t
val map : 'a t -> f:('a -> 'b) -> 'b t
val map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t
val map3 : 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd t
val all : 'a t list -> 'a list t
val both : 'a t -> 'b t -> ('a * 'b) t
module Applicative_infix : sig .. end
include module type of Applicative_infix
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

same as apply

val (<*) : 'a t -> unit t -> 'a t

same as apply

val (*>) : unit t -> 'a t -> 'a t

various internal values

val help : string Core_kernel.Std.Lazy.t t

the help text for the command

val path : string list t

the help text for the command

the subcommand path of the command

val args : string list t

the subcommand path of the command

the arguments passed to the command

val flag : ?aliases:string list -> ?full_flag_required:unit -> string -> 'a Flag.t -> doc:string -> 'a t

flag name spec ~doc specifies a command that, among other things, takes a flag named name on its command line. doc indicates the meaning of the flag.

All flags must have a dash at the beginning of the name. If name is not prefixed by "-", it will be normalized to "-" ^ name.

Unless full_flag_required is used, one doesn't have to pass name exactly on the command line, but only an unambiguous prefix of name (i.e., a prefix which is not a prefix of any other flag's name).

NOTE: the doc for a flag which takes an argument should be of the form arg_name ^ " " ^ description where arg_name describes the argument and description describes the meaning of the flag.

NOTE: flag names (including aliases) containing underscores will be rejected. Use dashes instead.

NOTE: "-" by itself is an invalid flag name and will be rejected.

val anon : 'a Anons.t -> 'a t

anon spec specifies a command that, among other things, takes the anonymous arguments specified by spec.

val choose_one : 'a option t list -> if_nothing_chosen:[
| `Default_to of 'a
| `Raise
] -> 'a t

choose_one clauses ~if_nothing_chosen expresses a sum type. It raises if more than one of clauses is Some _. When if_nothing_chosen = `Raise, it also raises if none of clauses is Some _.