line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wireguard::WGmeta::Cli::TerminalHelpers; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
14
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
6
|
use experimental 'signatures'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
85
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
155
|
|
6
|
|
|
|
|
|
|
our @EXPORT = qw(prettify_message BOLD RESET GREEN RED YELLOW); |
7
|
|
|
|
|
|
|
|
8
|
1
|
50
|
|
1
|
|
8
|
use constant BOLD => (!defined($ENV{'WG_NO_COLOR'})) ? "\e[1m" : ""; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
102
|
|
9
|
1
|
50
|
|
1
|
|
8
|
use constant RESET => (!defined($ENV{'WG_NO_COLOR'})) ? "\e[0m" : ""; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
82
|
|
10
|
1
|
50
|
|
1
|
|
7
|
use constant GREEN => (!defined($ENV{'WG_NO_COLOR'})) ? "\e[32m" : ""; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
11
|
1
|
50
|
|
1
|
|
7
|
use constant RED => (!defined($ENV{'WG_NO_COLOR'})) ? "\e[31m" : ""; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
12
|
1
|
50
|
|
1
|
|
7
|
use constant YELLOW => (!defined($ENV{'WG_NO_COLOR'})) ? "\e[33m" : ""; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
200
|
|
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
0
|
|
sub prettify_message($error, $is_warning) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
$error =~ s/at.*$//g unless (defined $ENV{IS_TESTING}); |
16
|
0
|
0
|
|
|
|
|
if ($is_warning == 1) { |
17
|
0
|
|
|
|
|
|
print BOLD . YELLOW . "Warning: " . RESET . $error; |
18
|
0
|
|
|
|
|
|
return; |
19
|
|
|
|
|
|
|
} |
20
|
0
|
|
|
|
|
|
print BOLD . RED . "Error: " . RESET . $error; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |