#!/usr/bin/perl
use 5.010;
use strict;
our $VERSION = '0.29'; # VERSION
binmode(STDOUT, ":utf8");
my $t = Text::ANSITable->new;
if ($ARGV[0]) {
$t->border_style($ARGV[0]);
}
my $all_bs = $t->list_border_styles(1);
$t->columns(['Name', 'Summary', 'box_chars?', 'utf8?']);
my $utf8; # we sort by not utf8 and then utf8, just to demonstrate add_row_separator
for my $name (sort {($all_bs->{$a}{utf8} ? 1:0)<=>($all_bs->{$b}{utf8} ? 1:0) || $a cmp $b} keys %$all_bs) {
my $bs = $all_bs->{$name};
my $selected = $name eq $t->border_style->{name};
$t->add_row(
[$name . ($selected ? " (*)" : ""), $bs->{summary}, $bs->{box_chars} ? 1:0, $bs->{utf8} ? 1:0],
{fgcolor=>$selected && $t->use_color ? "aaaa00" : undef});
if (!$utf8 && $bs->{utf8}) {
$t->add_row_separator;
$utf8++;
}
}
say "Tip: you can run me with border style name as argument to try it out.";
print $t->draw;
#use Data::Dump; dd $t->{_row_separators}; dd $t->{_draw}{frow_separators};
#ABSTRACT: List available border styles for Text::ANSITable
#PODNAME: ansitable-list-border-styles
__END__
=pod
=encoding UTF-8
=head1 NAME
ansitable-list-border-styles - List available border styles for Text::ANSITable
=head1 VERSION
version 0.29
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Text-ANSITable>.
=head1 SOURCE
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Text-ANSITable>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut