Permalink
Browse files

Adding "float" argument type

  • Loading branch information...
1 parent ff9ea6c commit 468026bb352bf41882094d6456893df8bf5e06ef @VictorNicollet committed May 4, 2012
Showing with 5 additions and 1 deletion.
  1. +3 −0 src/action.mli
  2. +2 −1 src/action_Args.ml
View
@@ -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)
View
@@ -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

0 comments on commit 468026b

Please sign in to comment.