package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=66b6e0b25769fc2363972c6a6ab6ac33
sha256=584d314cbaa5485e26d08ce87f7d7ff49043d9096101f2641b59def9aa6d7d71
doc/batteries.unthreaded/BatOptParse/StdOpt/index.html
Module BatOptParse.StdOpt
This module contains various standard options.
Flag options
val store_const : ?default:'a -> 'a -> 'a Opt.tstore_const ?default const returns a flag option which stores the constant value const when the option is encountered on the command line.
val store_true : unit -> bool Opt.tstore_true () returns an option which is set to true when it is encountered on the command line. The default value is false.
val store_false : unit -> bool Opt.tstore_false () returns an option which is set to false when it is encountered on the command line. The default value is true.
Create a counting option which increments its value each time the option is encountered on the command line.
Exactly identical to count_option ~dest:dest ~increment:1 ().
Exactly identical to count_option ~dest:dest ~increment:(-1) ().
Value options
val int_option : ?default:int -> ?metavar:string -> unit -> int Opt.tint_option ?default ?metavar () returns an option which takes a single integer argument. If ~default is given it is the default value returned when the option has not been encountered on the command line.
val float_option : ?default:float -> ?metavar:string -> unit -> float Opt.tSee OptParse.StdOpt.int_option.
val str_option : ?default:string -> ?metavar:string -> unit -> string Opt.tSee OptParse.StdOpt.int_option.
val any_option :
?default:'a option ->
?metavar:string ->
(string -> 'a) ->
'a Opt.tany_option ?default ?metavar coerce returns an option which takes a single argument from the command line and calls coerce to coerce it to the proper type.
default is the default value of the option. If None, the option has no default value.
Callback options
val int_callback : ?metavar:string -> (int -> unit) -> unit Opt.tint_callback ?metavar f returns an option which takes a single integer argument and calls f with that argument when encountered on the command line.
val float_callback : ?metavar:string -> (float -> unit) -> unit Opt.tSee OptParse.StdOpt.int_callback.
val str_callback : ?metavar:string -> (string -> unit) -> unit Opt.tSee OptParse.StdOpt.int_callback.
Special options
val help_option : unit -> 'a Opt.thelp_option () returns the standard help option which displays a usage message and exits the program when encountered on the command line.
val version_option : (unit -> string) -> 'a Opt.tversion_option f returns the standard version option which displays the string returned by f () (and nothing else) on standard output and exits.