X-Git-Url: http://git.ieval.ro/?p=nethack-naodash.git;a=blobdiff_plain;f=lib%2FApp%2FNAOdash.pm;h=5bf8b7a4584addd07d82037cfe9f5b06d841e3cc;hp=78428a33e0eeb4e5c866d0012f8c9bb6d1a557b5;hb=350c8f14c97a428aff2cf1a7267d61c22be127a9;hpb=01ba3ddc757514e3474b1c79855de5fea5da1445 diff --git a/lib/App/NAOdash.pm b/lib/App/NAOdash.pm index 78428a3..5bf8b7a 100644 --- a/lib/App/NAOdash.pm +++ b/lib/App/NAOdash.pm @@ -6,7 +6,7 @@ use warnings; use re '/saa'; use utf8; -our $VERSION = '0.001'; +our $VERSION = '0.003'; use Encode qw/encode/; use File::Slurp; @@ -85,20 +85,21 @@ EOF my $rst = RESET; for my $check (@order) { - my $color = (grep { $_ eq $check } @checks) ? GREEN '✓' : RED '✗'; + my $color = (grep { $_ eq $check } @checks) ? GREEN UNDERLINE : RED; $base =~ s/#([a-zA-Z-]+)/$color$1$rst/; } + $base =~ s/([A-Z ]+)\n=*/BOLD($1).RESET/ge; $base } sub run { - my ($user_or_path) = @_; + my ($args, $user_or_path) = @_; my $stats; if ($user_or_path =~ /^\w+$/) { # Looks like a user - $stats = naodash_user $user_or_path + $stats = naodash_user $args, $user_or_path } else { - $stats = naodash_xlog read_file $user_or_path + $stats = naodash_xlog $args, read_file $user_or_path } print encode 'UTF-8', naodash_to_ansi $stats ## no critic (RequireCheckedSyscalls) } @@ -129,8 +130,8 @@ It defines two functions: =item B(I<$stats>) Takes the result of B or B and presents it -in a text form, using ANSI color escape sequences and unicode ticks -(✓) and X marks (✗) to indicate the presence/absence of checks. +in a text form, using ANSI escape sequences to indicate the +presence/absence of checks. =item B(I<$user_or_path>)