]> Dogcows Code - chaz/git-codeowners/blob - lib/App/Codeowners/Formatter/Table.pm
Release App-Codeowners 0.43
[chaz/git-codeowners] / lib / App / Codeowners / Formatter / Table.pm
1 package App::Codeowners::Formatter::Table;
2 # ABSTRACT: Format codeowners output as a table
3
4 =head1 DESCRIPTION
5
6 This is a L<App::Codeowners::Formatter> that formats output using L<Text::Table::Any>.
7
8 =cut
9
10 use warnings;
11 use strict;
12
13 our $VERSION = '9999.999'; # VERSION
14
15 use parent 'App::Codeowners::Formatter';
16
17 use App::Codeowners::Util qw(stringify);
18 use Encode qw(encode);
19
20 sub finish {
21 my $self = shift;
22 my $results = shift;
23
24 eval { require Text::Table::Any } or die "Missing dependency: Text::Table::Any\n";
25
26 my $table = Text::Table::Any::table(
27 header_row => 1,
28 rows => [$self->columns, map { [map { stringify($_) } @$_] } @$results],
29 backend => $ENV{PERL_TEXT_TABLE},
30 );
31 print { $self->handle } encode('UTF-8', $table);
32 }
33
34 1;
This page took 0.038549 seconds and 4 git commands to generate.