Batteries user guide : Extlib.OptParse

`sig
module Opt :
sig
exception No_value
exception Option_error of string * string
exception Option_help
type 'a t =
'a BatOptParse.Opt.t = {
option_set : string -> string list -> unit;
option_set_value : 'a -> unit;
option_get : unit -> 'a option;
option_metavars : string list;
option_defhelp : string option;
}
val get : 'a t -> 'a
val set : 'a t -> 'a -> unit
val opt : 'a t -> 'a option
val is_set : 'a t -> bool
val value_option :
string ->
'a option -> (string -> 'a) -> (exn -> string -> string) -> 'a t
val callback_option :
string ->
(string -> 'a) -> (exn -> string -> string) -> ('a -> unit) -> unit t
end
module StdOpt :
sig
val store_const : ?default:'a -> 'a -> 'a Opt.t
val store_true : unit -> bool Opt.t
val store_false : unit -> bool Opt.t
val count_option : ?dest:int ref -> ?increment:int -> unit -> int Opt.t
val incr_option : ?dest:int ref -> unit -> int Opt.t
val decr_option : ?dest:int ref -> unit -> int Opt.t
val int_option : ?default:int -> ?metavar:string -> unit -> int Opt.t
val float_option :
?default:float -> ?metavar:string -> unit -> float Opt.t
val str_option :
?default:string -> ?metavar:string -> unit -> string Opt.t
val any_option :
?default:'a option -> ?metavar:string -> (string -> 'a) -> 'a Opt.t
val int_callback : ?metavar:string -> (int -> unit) -> unit Opt.t
val float_callback : ?metavar:string -> (float -> unit) -> unit Opt.t
val str_callback : ?metavar:string -> (string -> unit) -> unit Opt.t
val help_option : unit -> 'a Opt.t
val version_option : (unit -> string) -> 'a Opt.t
end
module Formatter :
sig
type t =
BatOptParse.Formatter.t = {
indent : unit -> unit;
dedent : unit -> unit;
format_usage : string -> string;
format_heading : string -> string;
format_description : string -> string;
format_option :
char list * string list -> string list -> string option -> string;
}
val indented_formatter :
?level:int ref ->
?indent:int ref ->
?indent_increment:int ->
?max_help_position:int ->
?width:int -> ?short_first:bool -> unit -> t
val titled_formatter :
?level:int ref ->
?indent:int ref ->
?indent_increment:int ->
?max_help_position:int ->
?width:int -> ?short_first:bool -> unit -> t
val wrap :
?initial_indent:int ->
?subsequent_indent:int -> string -> int -> string list
val fill :
?initial_indent:int ->
?subsequent_indent:int -> string -> int -> string
end
module OptParser :
sig
exception Option_conflict of string
type t = BatOptParse.OptParser.t
type group = BatOptParse.OptParser.group
val make :
?usage:string ->
?description:string ->
?version:string ->
?suppress_usage:bool ->
?suppress_help:bool ->
?only_leading_opts:bool ->
?prog:string -> ?formatter:Formatter.t -> unit -> t
val add :
t ->
?group:group ->
?help:string ->
?hide:bool ->
?short_name:char ->
?short_names:char list ->
?long_name:string -> ?long_names:string list -> 'a Opt.t -> unit
val add_group :
t -> ?parent:group -> ?description:string -> string -> group
val error : t -> ?chn:out_channel -> ?status:int -> string -> unit
val usage : t -> ?chn:out_channel -> unit -> unit
val parse : t -> ?first:int -> ?last:int -> string array -> string list
val parse_argv : t -> string list
end
end`