From fc06bf8618409d34186fa2091dce2f6ab4ecc9f2 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 12 Jun 2022 23:02:10 +0200 Subject: implement option format --- bin/feature-check.pl | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/feature-check.pl b/bin/feature-check.pl index 2c36d81..e6f3514 100755 --- a/bin/feature-check.pl +++ b/bin/feature-check.pl @@ -65,6 +65,8 @@ my @OPT = (); feature-check [OPTION...] + feature-check --format graphviz | fdp -Tx11 + =head1 DESCRIPTION B is a command-line tool @@ -76,6 +78,25 @@ based on coverage and embedded annotations of its documentation. =head1 OPTIONS +=head2 Rendering + +=over 16 + +=item B<--format> + +Output format, either of I I I I I +S<(default value: I)> + +=back + +=cut + +push @OPT, qw( + format=s +); + +$OPT{'format'} = 'ansi'; + =head2 General =over 16 @@ -181,9 +202,14 @@ my $table = Term::Table->new( rows => \@row, ); -say $_ for $table->render; - -print $graph->as_boxart(); +for ( $OPT{format} ) { + map { say $_ } $table->render when 'table'; + print $graph->as_ascii() when 'ascii'; + print $graph->as_boxart() when 'ansi'; + print $graph->as_svg() when 'svg'; + print $graph->as_graphviz() when 'graphviz'; + default { $log->fatal("unsupported format:$_") && exit 1 } +} $log->error($_) for $graph->errors(); $log->warn($_) for $graph->warnings(); -- cgit v1.2.3