Ordo/Command/Job/Hold.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 46 CC 3 SCAR 16.1
CC
3
Cov
0%
execute
12.0
name
2.0
summary
2.0
CRAP 5.0
1 # Example: lib/App/Ordo/Command/Job/Hold.pm
2 package App::Ordo::Command::Job::Hold;
3 use feature qw(say);
4 use Moo;
5 extends 'App::Ordo::Command::Base';
6 use Term::ANSIColor qw(colored);
7  
8 sub name { "job hold" }
9 sub summary { "Pause a job from running" }
10 sub usage { "<path/name>" }
11  
12 sub option_spec { {} }
13  
14 sub execute {
15 my ($self, $opt, $name) = @_;
16 unless ($name) {
17 say colored(["bold red"], "Usage: job hold <path/name>");
18 return;
19 }
20  
21 my $res = $self->api->call('hold_job', { name => $name });
22  
23 $res->{success}
24 ? say colored(["bold yellow"], "Job '$name' held")
25 : say colored(["bold red"], "Failed: " . ($res->{message} || 'error'));
26 }
27  
28 1;