Skip to content

Commit

Permalink
During --stats, print "No unneeded packages found..." when no uneed…
Browse files Browse the repository at this point in the history
…ed packages are found.
  • Loading branch information
trizen committed Apr 28, 2019
1 parent 7b3ded2 commit f54e77e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions trizen
Original file line number Diff line number Diff line change
Expand Up @@ -2692,17 +2692,23 @@ $c{bblue}::$c{reset} $c{bold}Oldest installed packages:$c{byellow} @{[map { $_->
$c{bblue}::$c{reset} $c{bold}Newest installed packages:$c{byellow} @{[map { $_->[0] } @{$packages{installed}{new}}]}$c{reset}\n
STATS

print "$c{bblue}::$c{reset} $c{bold}Unneeded packages:$c{byellow}";
my @unneeded_pkgs;

while (my ($key, $value) = each %reason_deps) {
next if exists $dependencies{$key};
if (ref($value) eq 'ARRAY') {
next if first { exists($dependencies{$_}) } @$value;
}
print qq{ $key};
push @unneeded_pkgs, $key;
}

if (@unneeded_pkgs) {
say "$c{bblue}::$c{reset} $c{bold}Unneeded packages:$c{byellow} ", join(' ', @unneeded_pkgs), $c{reset};
}
else {
say "$c{bblue}::$c{reset} $c{bold}No unneeded packages found...$c{reset}";
}

say $c{reset};
main_quit();
}

Expand Down

0 comments on commit f54e77e

Please sign in to comment.