line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Console::Output; |
2
|
1
|
|
|
1
|
|
6
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
620
|
use Term::ANSIColor; |
|
1
|
|
|
|
|
6813
|
|
|
1
|
|
|
|
|
326
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has 'sameline' => 1; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub error { |
9
|
0
|
|
|
0
|
0
|
|
shift->wrap(@_, 'bright_red', 1); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub info { |
13
|
0
|
|
|
0
|
0
|
|
shift->wrap(@_, 'bright_cyan'); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub line { |
17
|
0
|
|
|
0
|
0
|
|
shift->wrap(@_); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub newline { |
21
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $sameline = $self->sameline; |
24
|
0
|
|
|
|
|
|
$self->sameline(0); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$self->wrap(@_); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$self->sameline($sameline); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub success { |
32
|
0
|
|
|
0
|
0
|
|
shift->wrap(@_, 'bright_green'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub warn { |
36
|
0
|
|
|
0
|
0
|
|
shift->wrap(@_, 'bright_yellow'); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub wrap { |
40
|
0
|
|
|
0
|
0
|
|
my ($self, $message, $color, $error) = @_; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
0
|
|
|
|
$error ||= 0; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if ($error) { |
45
|
0
|
0
|
|
|
|
|
print STDERR color($color) if ($color); |
46
|
0
|
|
|
|
|
|
print STDERR $message; |
47
|
0
|
0
|
|
|
|
|
print STDERR color('reset') if ($color); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
exit; |
50
|
|
|
|
|
|
|
} else { |
51
|
0
|
0
|
|
|
|
|
print STDOUT color($color) if ($color); |
52
|
0
|
0
|
|
|
|
|
print STDOUT sprintf("%s%s", $message, ($self->sameline ? '' : "\n")); |
53
|
0
|
0
|
|
|
|
|
print STDOUT color('reset') if ($color); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |