Printing parameters of type 'a back to their expected command line syntax. Printing parameter is used for example when documenting default values in the help messages.
type'a t
A type to hold the capability of parsing and printing a parameter of type 'a.
val create : docv:string ->parse:'aparse->print:'aprint->'at
Basic types
The API supports basic types with default docv values. These defaults can be overridden for each argument. The default docv is used only if none is specified at the argument level. The actual syntax used by default depend on the targeted backend.
Create a parameter for an enumerated type. The module must implement the Enumerated_stringable interface.
Example:
module Color = struct
type t =
| Red
| Green
| Blue
let all = [ Red; Green; Blue ]
let to_string = function
| Red -> "red"
| Green -> "green"
| Blue -> "blue"
;;
end
let color_param = Param.enumerated ~docv:"COLOR" (module Color)
The usage message will show the supported values for COLOR.
val stringable : ?docv:string ->(moduleStringablewithtypet = 'a)->'at
val validated_string :
?docv:string ->(moduleValidated_stringwithtypet = 'a)->'at
To be used with custom types when the parsing may fail.