From e67f477839ab1e1937c9c03853f713207d859259 Mon Sep 17 00:00:00 2001 From: "Andreas J. Koenig" Date: Wed, 1 Oct 2008 06:31:39 +0200 Subject: [PATCH] add headlines to the overview --- lib/File/Rsync/Mirror/Recent.pm | 21 ++++++++++++++++++--- t/02-operation.t | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/File/Rsync/Mirror/Recent.pm b/lib/File/Rsync/Mirror/Recent.pm index 805a8f6..ef5b80d 100644 --- a/lib/File/Rsync/Mirror/Recent.pm +++ b/lib/File/Rsync/Mirror/Recent.pm @@ -265,10 +265,15 @@ sub overview { push @s, $rfsummary; } @rank{sort {$b <=> $a} keys %rank} = 1..keys %rank; + my $maxrank = max values %rank; for my $s (@s) { - my $string = " " x (max values %rank); + my $string = " " x $maxrank; + my @borders; for (2,3) { - substr($string,$rank{$s->[$_]}-1,1) = "^"; + push @borders, $rank{$s->[$_]}-1; + } + for ($borders[0],$borders[1]) { + substr($string,$_,1) = "^"; } push @$s, $string; } @@ -279,7 +284,17 @@ sub overview { } my $sprintf = join " ", @sprintf; $sprintf .= "\n"; - join "", map { sprintf $sprintf, @$_ } @s; + my $headline = sprintf $sprintf, + ( + "", + "Cnt", + "Max", + "Min", + "Span", + "Util", # u9n:) + "Cloud", + ); + join "", $headline, map { sprintf $sprintf, @$_ } @s; } =head2 _pathdb diff --git a/t/02-operation.t b/t/02-operation.t index 08e04a4..2431ea1 100644 --- a/t/02-operation.t +++ b/t/02-operation.t @@ -314,7 +314,7 @@ rmtree [$root_from, $root_to]; ( # ($root_from, $root_to) local => "$root_from/RECENT-5s.yaml", ); - # diag $recc->overview; + diag $recc->overview; } { my $recc = File::Rsync::Mirror::Recent->new -- 2.11.4.GIT