Imager/CommandLine/TagImages.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 38 CC 2 SCAR 11.5
CC
2
Cov
0%
run
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.1
1 package Imager::CommandLine::TagImages {
2 use MooseX::App;
3 use ARGV::Struct;
4 use CloudDeploy::AMIDB;
5 use Data::Printer;
6 use v5.10;
7  
8 has find_args => (
9 is => 'ro',
10 isa => 'HashRef[Str]',
11 lazy => 1,
12 default => sub {
13 my $self = shift;
14 return ARGV::Struct->new(argv => [ '{', @{ $self->extra_argv }, '}' ])->parse;
15 }
16 );
17  
18 parameter tag => (
19 is => 'ro',
20 isa => 'Str',
21 documentation => 'The tag to assign',
22 required => 1,
23 );
24  
25 sub run {
26 my ($self) = @_;
27  
28 die "You have to specify a filter to tag an AMI" if (keys %{ $self->find_args } == 0);
29  
30 my $db = CloudDeploy::AMIDB->new;
31  
32 my $tagged = $db->set_tag_to($self->tag, %{ $self->find_args });
33  
34 foreach (@$tagged) { say "Tagged $_" }
35 }
36 }
37  
38 1;
39