aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2022-06-12 23:02:10 +0200
committerJonas Smedegaard <dr@jones.dk>2022-06-12 23:02:10 +0200
commitfc06bf8618409d34186fa2091dce2f6ab4ecc9f2 (patch)
treec73a5cdc228c14b85dc550d0c0a3aefc497b3e1c /bin
parentd3868f9a33c9f232bdf4c7424d27cd55932aa8c8 (diff)
implement option format
Diffstat (limited to 'bin')
-rwxr-xr-xbin/feature-check.pl32
1 files changed, 29 insertions, 3 deletions
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<feature-check> 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<table> I<ascii> I<ansi> I<svg> I<graphviz>
+S<(default value: I<ansi>)>
+
+=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();