Module Arg.Conv

Argument converters.

An argument converter transforms a string argument of the command line to an OCaml value. Predefined converters are provided for many types of the standard library.

type 'a parser = string -> ('a, string) Stdlib.result

The type for parsing arguments to values of type 'a.

type 'a fmt = Stdlib.Format.formatter -> 'a -> unit

The type for formatting values of type 'a.

type 'a t

The type for convertering arguments to values of type 'a.

val make : ?completion:'a Completion.t -> docv:string -> parser:'a parser -> pp:'a fmt -> unit -> 'a t

make ~docv ~parser ~pp () is an argument converter with given properties. See corresponding accessors for semantics.

val of_conv : 'a t -> ?completion:'a Completion.t -> ?docv:string -> ?parser:'a parser -> ?pp:'a fmt -> unit -> 'a t

of_conv conv () is a new converter with given unspecified properties defaulting to those of conv.

val docv : 'a t -> string

docv c is c's documentation meta-variable. This value can be refered to as $(docv) in the documentation strings of arguments. It can be overriden by the info value of an argument.

val parser : 'a t -> 'a parser

parser c is c's argument parser.

val pp : 'a t -> 'a fmt

pp c is c's argument formatter.

val completion : 'a t -> 'a Completion.t

completion c is c's completion.