SD/CLI/Command/Ticket/Details.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 50 CC 1 SCAR 6.9
CC
1
Cov
0%
by_creation_date
2.0
usage_msg
2.0
BEGIN
2.0
CRAP 2.0
1 package App::SD::CLI::Command::Ticket::Details;
2 use Any::Moose;
3 extends 'App::SD::CLI::Command::Ticket::Show';
4  
5 sub by_creation_date { $a->prop('created') cmp $b->prop('created') };
6  
7 sub usage_msg {
8 my $self = shift;
9 my ($cmd, $type_and_subcmd) = $self->get_cmd_and_subcmd_names;
10  
11 # XXX TODO Review these options
12 return <<"END_USAGE";
13 usage: ${cmd}${type_and_subcmd} <record-id> [options]
14  
15 Options are:
16 -a|--all-props Show props even if they aren't common
17 -b|--batch
18 END_USAGE
19 }
20  
21 override run => sub {
22 my $self = shift;
23  
24 $self->print_usage if $self->has_arg('h');
25  
26 $self->require_uuid;
27 my $record = $self->_load_record;
28  
29 print "\n=head1 METADATA\n\n";
30 super();
31  
32 my @attachments = sort by_creation_date @{$record->attachments};
33 if (@attachments) {
34 print "\n=head1 ATTACHMENTS\n\n";
35 print $_->format_summary . "\n"
36 for @attachments;
37 }
38  
39 my @comments = sort by_creation_date @{$record->comments};
40 if (@comments) {
41 print "\n=head1 COMMENTS\n\n";
42 for my $comment (@comments) {
43 my $creator = $comment->prop('creator');
44 my $created = $comment->prop('created');
45 my $content = $comment->prop('content');
46 print "$creator: " if $creator;
47 print "$created\n$content\n\n";
48 }
49 }
50  
51 print "\n=head1 HISTORY\n\n";
52 print $record->history_as_string;
53 };
54  
55 __PACKAGE__->meta->make_immutable;
56 no Any::Moose;
57  
58 1;
59