diff --git a/src/action.mli b/src/action.mli index 8e0df76..9435370 100644 --- a/src/action.mli +++ b/src/action.mli @@ -233,6 +233,9 @@ module Args : sig (** An integer cell. *) val int : int cell + (** A floating-point cell. *) + val float : float cell + (** The type of an argument parser. *) type 'args t = ('args -> string list) * (string list -> 'args option) diff --git a/src/action_Args.ml b/src/action_Args.ml index 96aeaf9..cea48a7 100644 --- a/src/action_Args.ml +++ b/src/action_Args.ml @@ -2,7 +2,8 @@ type 'a cell = ('a -> string) * (string -> 'a option) type 'args t = ('args -> string list) * (string list -> 'args option) let string = (fun str -> str), (fun str -> Some str) -let int = string_of_int, (fun i -> try Some (int_of_string i) with _ -> None) +let int = string_of_int, (fun i -> try Some ( int_of_string i) with _ -> None) +let float = string_of_float, (fun i -> try Some (float_of_string i) with _ -> None) let parse (_,f) list = f list let generate (g,_) args = g args