From: Mischa POSLAWSKY Date: Tue, 1 Nov 2022 18:41:46 +0000 (+0100) Subject: draw mascot cat in usage message X-Git-Tag: v1.08~1 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/1dd74b3f458ea405a33fd03554f5fa4587ae879b draw mascot cat in usage message --- diff --git a/barcat b/barcat index dfe6a10..da09547 100755 --- a/barcat +++ b/barcat @@ -352,9 +352,9 @@ sub show_exit { show_exit(); __END__ -Usage: - barcat [OPTIONS] [FILES|NUMBERS] - +Usage: /\_/\ + barcat [OPTIONS] [FILES|NUMBERS] (=•.•=) + (u u) Options: -a, --[no-]ascii Restrict user interface to ASCII characters -c, --[no-]color Force colored output of values and bar markers diff --git a/mascot.txt b/mascot.txt new file mode 100644 index 0000000..0eecad7 --- /dev/null +++ b/mascot.txt @@ -0,0 +1,3 @@ + /\_/\ +(=•.•=) +(u u) 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;