App-Ordo
view release on metacpan or search on metacpan
lib/App/Ordo/Command/Job/Hold.pm view on Meta::CPAN
# Example: lib/App/Ordo/Command/Job/Hold.pm
package App::Ordo::Command::Job::Hold;
use feature qw(say);
use Moo;
extends 'App::Ordo::Command::Base';
use Term::ANSIColor qw(colored);
sub name { "job hold" }
sub summary { "Pause a job from running" }
sub usage { "<path/name>" }
sub option_spec { {} }
sub execute {
my ($self, $opt, $name) = @_;
unless ($name) {
say colored(["bold red"], "Usage: job hold <path/name>");
return;
}
my $res = $self->api->call('hold_job', { name => $name });
$res->{success}
? say colored(["bold yellow"], "Job '$name' held")
: say colored(["bold red"], "Failed: " . ($res->{message} || 'error'));
}
1;
( run in 0.693 second using v1.01-cache-2.11-cpan-9581c071862 )