X-Git-Url: http://git.ieval.ro/?p=gruntmaster-data.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FApp%2FCommand%2FRerun.pm;fp=lib%2FGruntmaster%2FApp%2FCommand%2FRerun.pm;h=4856b33b0ac661fa0937e2d9405a357d152a8374;hp=bb4c0c8c6cb1d6928eb6bc82b563982c804536db;hb=9baaf76b50b8888c5f851d1469b5d45255838738;hpb=8ab124f5b4b8d8c871c3bf2c3fb11eb17f61d2f6 diff --git a/lib/Gruntmaster/App/Command/Rerun.pm b/lib/Gruntmaster/App/Command/Rerun.pm index bb4c0c8..4856b33 100644 --- a/lib/Gruntmaster/App/Command/Rerun.pm +++ b/lib/Gruntmaster/App/Command/Rerun.pm @@ -7,20 +7,28 @@ our $VERSION = '5999.000_015'; use Gruntmaster::App '-command'; use Gruntmaster::Data; +use Scalar::Util qw/looks_like_number/; -sub usage_desc { '%c rerun id' } +sub usage_desc { '%c rerun id...' } sub validate_args { my ($self, $opt, $args) = @_; my @args = @$args; - $self->usage_error('This command only works on jobs') if $self->app->table && $self->app->table ne 'jobs'; - $self->usage_error('Wrong number of arguments') if @args != 1; + $self->usage_error('Not enough arguments') if @args < 1; } sub execute { my ($self, $opt, $args) = @_; - my ($obj) = @$args; - rerun_job $obj; + my @args = @$args; + + for my $obj (@args) { + if (looks_like_number $obj) { + rerun_job $obj; + } + else { + rerun_problem $obj; + } + } } 1; @@ -30,16 +38,19 @@ __END__ =head1 NAME -Gruntmaster::App::Command::Rerun - rerun a job +Gruntmaster::App::Command::Rerun - rerun some jobs and probles =head1 SYNOPSIS - gm rerun 123 + gm rerun 123 124 + + gm rerun aplusb aminusb + + gm rerun 12 aplusb =head1 DESCRIPTION -The rerun command takes the ID of a job, clears its result, and makes -B rerun it. +The rerun command takes some IDs of jobs and problems and reruns them. =head1 SEE ALSO