diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-05 13:47:16 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-05 13:47:16 +0100 |
commit | fae2c83aff6c216a84bfb4317c821b8199e18c0a (patch) | |
tree | 50b097dff237593621a05992e404032723c13cb2 /sbocheck | |
parent | 90c7e9fb01615e21c20c0aca0b3ecf62b73d3c49 (diff) | |
download | sbotools-fae2c83aff6c216a84bfb4317c821b8199e18c0a.tar.xz |
Change the sbocheck output slightly
Closes #10
Diffstat (limited to 'sbocheck')
-rwxr-xr-x | sbocheck | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; } |