szaghi / FLAP

Fortran command Line Arguments Parser for poor people
150 stars 34 forks source link

add "range" CLA option along-side "choices" #73

Open szaghi opened 7 years ago

szaghi commented 7 years ago

Currently, a CLA can have the optional choices checker to verify if the passed argument is allowed. This is good for checking against a finite number of allowed values, but if one want to check against an infinite set values that must only be bounded into a range (e.g. if x in [0.2, 12.1) ) the choices option is not viable.

Thus add a new optional, e.g.

call cli%add(switch='--foo', range='[0.1, 20.)', required=.false., def='5.') ! 0.1 is include in the range, while 20. not

(trick: maybe temporary promote all check in real even if the CLA is integer)