X-Git-Url: http://git.shiar.nl/barcat.git/blobdiff_plain/58630a8d85739e139af830d0cef81beb0510fc60..1dd74b3f458ea405a33fd03554f5fa4587ae879b:/reformat-podusage diff --git a/reformat-podusage b/reformat-podusage index cbb25cc..c40363d 100755 --- a/reformat-podusage +++ b/reformat-podusage @@ -1,6 +1,7 @@ #!/usr/bin/env perl use 5.014; use warnings; +use utf8; use open qw( :std :utf8 ); use re '/msx'; @@ -34,6 +35,16 @@ $parser->parse_string_document($pod); $usage =~ s/\n(?=\n\h)//msg; # strip space between items $usage =~ s/^\ \ \K____/ /g; # nbsp substitute +if (open my $logo, '<', 'mascot.txt') { + # append logo lines to top usage lines + my @ll = split /\n/, readline $logo; + my @ul = split /\n/, $usage, @ll + 1; + # centered in empty space on the second (longest) line + my $pad = (78 - 1 + length($ul[1]) - length($ll[0])) >> 1; + $ul[$_] .= (' ' x ($pad - length($ul[$_]))) . $ll[$_] for 0..$#ll; + $usage = join "\n", @ul; +} + if ($ARGV eq '-') { # custom formatted minimal usage text from pod document print $usage;