nategood / commando

An Elegant CLI Library for PHP
MIT License
798 stars 80 forks source link

Should be able to define more than one validation rule, and rules should allow for an error message #86

Open kael-shipman opened 6 years ago

kael-shipman commented 6 years ago

Should be able to do this:

$cmd->option('t')
    ->must(function($t) {
        return is_int($t);
    }, "Option `t` must be an integer")
    ->must(function($t) {
        return $t >= 0 && $t <= 10;
    }, "Option `t` must be between 0 and 10 inclusive.");
kael-shipman commented 6 years ago

Again, will PR if spec approved.