X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FApp%2FCommand%2FRerun.pm;h=b12dda089cb97b7db3b50e712ae6acdb1f1e682b;hb=b35cbc0d6ca5baf03ffbeb2b9a375fa71f4d0ad3;hp=a63800b9bf4bcfc2242d7df5cb1c1faecad50250;hpb=686bacca70a42bb30472d8d1db02ed8ce77fda4d;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/App/Command/Rerun.pm b/lib/Gruntmaster/App/Command/Rerun.pm index a63800b..b12dda0 100644 --- a/lib/Gruntmaster/App/Command/Rerun.pm +++ b/lib/Gruntmaster/App/Command/Rerun.pm @@ -3,25 +3,70 @@ package Gruntmaster::App::Command::Rerun; use 5.014000; use warnings; -our $VERSION = '5999.000_004'; +our $VERSION = '5999.000_016'; 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; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::Rerun - rerun some jobs and probles + +=head1 SYNOPSIS + + gm rerun 123 124 + + gm rerun aplusb aminusb + + gm rerun 12 aplusb + +=head1 DESCRIPTION + +The rerun command takes some IDs of jobs and problems and reruns them. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014-2016 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut