sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit fae2c83aff6c216a84bfb4317c821b8199e18c0a
parent 90c7e9fb01615e21c20c0aca0b3ecf62b73d3c49
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date:   Sat,  5 Dec 2015 13:47:16 +0100

Change the sbocheck output slightly

Closes #10

Diffstat:
Msbocheck | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sbocheck b/sbocheck @@ -15,6 +15,7 @@ use warnings FATAL => 'all'; use SBO::Lib; use Getopt::Long; use File::Basename; +use List::Util 'max'; my $self = basename($0); @@ -50,8 +51,7 @@ sub get_update_list { # fits in 80 chars; stuff that doesn't will overflow. my @up_lengths; push @up_lengths, length $$updates[$_]{update} for keys @$updates; - my @s_up_lengths = sort {$b <=> $a} @up_lengths; - my $up_length = $s_up_lengths[0]; + my $up_length = max @up_lengths; # "needs updating" bit without version is 30 characters my $remaining = 80 - ($up_length + 30); my @lengths; @@ -69,8 +69,9 @@ sub get_update_list { my @listing; for my $update (@$updates) { + my $name = sprintf "%s %s", $$update{name}, $$update{installed}; push(@listing, sprintf "%-${min}s < needs updating (SBo has %s)", - "$$update{name}-$$update{installed}", "$$update{update}"); + $name, $$update{update}); } return \@listing; }