mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-06-05 10:31:31 +00:00
5to6 add color support
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
2722899807
commit
6acde780f6
@ -17,6 +17,8 @@ use PVE::RPCEnvironment;
|
|||||||
use PVE::Storage;
|
use PVE::Storage;
|
||||||
use PVE::Tools;
|
use PVE::Tools;
|
||||||
|
|
||||||
|
use Term::ANSIColor;
|
||||||
|
|
||||||
use PVE::CLIHandler;
|
use PVE::CLIHandler;
|
||||||
|
|
||||||
use base qw(PVE::CLIHandler);
|
use base qw(PVE::CLIHandler);
|
||||||
@ -47,7 +49,9 @@ my $log_line = sub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
sub log_pass {
|
sub log_pass {
|
||||||
|
print color('green');
|
||||||
$log_line->('pass', @_);
|
$log_line->('pass', @_);
|
||||||
|
print color('reset');
|
||||||
}
|
}
|
||||||
|
|
||||||
sub log_info {
|
sub log_info {
|
||||||
@ -57,10 +61,14 @@ sub log_skip {
|
|||||||
$log_line->('skip', @_);
|
$log_line->('skip', @_);
|
||||||
}
|
}
|
||||||
sub log_warn {
|
sub log_warn {
|
||||||
|
print color('yellow');
|
||||||
$log_line->('warn', @_);
|
$log_line->('warn', @_);
|
||||||
|
print color('reset');
|
||||||
}
|
}
|
||||||
sub log_fail {
|
sub log_fail {
|
||||||
|
print color('red');
|
||||||
$log_line->('fail', @_);
|
$log_line->('fail', @_);
|
||||||
|
print color('reset');
|
||||||
}
|
}
|
||||||
|
|
||||||
my $get_pkg = sub {
|
my $get_pkg = sub {
|
||||||
@ -357,12 +365,12 @@ __PACKAGE__->register_method ({
|
|||||||
check_misc();
|
check_misc();
|
||||||
|
|
||||||
print "\n\nSUMMARY:\n";
|
print "\n\nSUMMARY:\n";
|
||||||
print "PASSED: $counters->{pass}\n";
|
print colored("PASSED: $counters->{pass}\n", 'green');
|
||||||
print "SKIPPED: $counters->{skip}\n";
|
print "SKIPPED: $counters->{skip}\n";
|
||||||
print "WARNINGS: $counters->{warn}\n";
|
print colored("WARNINGS: $counters->{warn}\n", 'yellow');
|
||||||
print "FAILURES: $counters->{fail}\n";
|
print colored("FAILURES: $counters->{fail}\n", 'red');
|
||||||
|
|
||||||
print "\nATTENTION: Please check the output for detailed information!\n"
|
print colored("\nATTENTION: Please check the output for detailed information!\n", 'red')
|
||||||
if ($counters->{warn} > 0 || $counters->{fail} > 0);
|
if ($counters->{warn} > 0 || $counters->{fail} > 0);
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
|
Loading…
Reference in New Issue
Block a user