type numeric_str = Number_string of string | Range_string of string
type numeric_val = Number_float of float | Range_float of float * float
type options = {
positive: bool;
nonnegative: bool;
allow_float: bool;
ranges: string list;
not_ranges: string list;
+ not_values: string list;
relative: bool;
allow_range: bool;
}
let default_opts = {
positive = false;
nonnegative = false;
allow_float = false;
ranges = [];
not_ranges = [];
+ not_values = [];
relative = false;
allow_range = false;
}
let opts = ref default_opts
let number_arg = ref ""
let args = [
("--non-negative", Arg.Unit (fun () -> opts := {!opts with nonnegative=true}), "Check if the number is non-negative (>= 0)");
("--positive", Arg.Unit (fun () -> opts := {!opts with positive=true}), "Check if the number is positive (> 0)");
("--range", Arg.String (fun s -> let optsv = !opts in opts := {optsv with ranges=(s :: optsv.ranges)}), "Check if the number or range is within a range (inclusive)");
("--not-range", Arg.String (fun s -> let optsv = !opts in opts := {optsv with not_ranges=(s :: optsv.not_ranges)}), "Check if the number or range is not within a range (inclusive)");
+ ("--not-value", Arg.String (fun s -> let optsv = !opts in opts := {optsv with not_values=(s :: optsv.not_values)}), "Check if the number does not equal a specific value");