forked from germedeb/IconToaster
Adding colors and using sort uniq on declared icons.
This commit is contained in:
parent
2751e2334d
commit
211097b541
45
functions.sh
45
functions.sh
@ -35,6 +35,20 @@ use v5.30.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Term::ANSIColor;
|
||||
|
||||
$SIG{INT} = sub {
|
||||
color_wrapper('reset');
|
||||
};
|
||||
|
||||
sub color_wrapper {
|
||||
print color(shift) if -t STDOUT || $ENV{TOASTER_COLOR};
|
||||
}
|
||||
|
||||
color_wrapper('yellow');
|
||||
say 'This is the Toasters Icon Pack Missing Icons Tool';
|
||||
color_wrapper('reset');
|
||||
|
||||
my $desktop_search_file = $ARGV[0];
|
||||
my $icon_search_file = $ARGV[1];
|
||||
|
||||
@ -47,10 +61,14 @@ while (my $line = <$desktop_filehandle>) {
|
||||
close $desktop_filehandle;
|
||||
|
||||
open my $icon_filehandle, '<', $icon_search_file;
|
||||
say '
|
||||
|
||||
color_wrapper('red');
|
||||
say << 'EOS';
|
||||
|
||||
Known Icons:
|
||||
-------------
|
||||
';
|
||||
EOS
|
||||
color_wrapper('reset');
|
||||
while (my $line = <$icon_filehandle>) {
|
||||
chomp $line;
|
||||
say $line;
|
||||
@ -58,15 +76,30 @@ while (my $line = <$icon_filehandle>) {
|
||||
}
|
||||
close $icon_filehandle;
|
||||
|
||||
say '
|
||||
color_wrapper('red');
|
||||
say << 'EOS';
|
||||
|
||||
Missing icons:
|
||||
-------------
|
||||
';
|
||||
EOS
|
||||
color_wrapper('reset');
|
||||
for my $key (keys %desktop_relation) {
|
||||
unless ($desktop_relation{$key}) {
|
||||
say $key;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
) <(desktopsearch) <(iconsearch $icon_pack)
|
||||
color_wrapper('red');
|
||||
say << 'EOS';
|
||||
|
||||
Not missing in your system icons:
|
||||
-------------
|
||||
EOS
|
||||
color_wrapper('reset');
|
||||
for my $key (keys %desktop_relation) {
|
||||
if ($desktop_relation{$key}) {
|
||||
say $key;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
) <(desktopsearch) <(iconsearch $icon_pack | sort | uniq)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user