File tree Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ package utils;
11
11
use FileHandle;
12
12
use Getopt::Long;
13
13
use Time::Local qw( timelocal) ;
14
+ use Term::ANSIColor;
14
15
use strict;
15
16
$| =1;
16
17
@@ -19,7 +20,8 @@ BEGIN {
19
20
use vars qw( $VERSION @ISA @EXPORT) ;
20
21
@ISA = qw( Exporter) ;
21
22
@EXPORT = qw( &read_rcfile &mk_fd_nonblocking &clrscr &clreol &delline
22
- &gotoxy &hidecursor &showcursor &get_winsize) ;
23
+ &gotoxy &hidecursor &showcursor &get_winsize
24
+ ¬ice &warning &fatal_warning &attention) ;
23
25
}
24
26
25
27
# read the content of configure file.
@@ -125,3 +127,39 @@ sub get_winsize {
125
127
126
128
return ($row , $col );
127
129
}
130
+
131
+ # print notice message in color of green.
132
+ sub notice {
133
+ my $message = shift ;
134
+
135
+ print color " green" ;
136
+ print " $message \n " ;
137
+ print color " reset" ;
138
+ }
139
+
140
+ # print warning message in color of yellow.
141
+ sub warning {
142
+ my $message = shift ;
143
+
144
+ print color " yellow" ;
145
+ print " $message \n " ;
146
+ print color " reset" ;
147
+ }
148
+
149
+ # print fatal_warning message in color of red.
150
+ sub fatal_warning {
151
+ my $message = shift ;
152
+
153
+ print color " red" ;
154
+ print " $message \n " ;
155
+ print color " reset" ;
156
+ }
157
+
158
+ # print attention message in color of blue.
159
+ sub attention {
160
+ my $message = shift ;
161
+
162
+ print color " blue" ;
163
+ print " $message \n " ;
164
+ print color " reset" ;
165
+ }
You can’t perform that action at this time.
0 commit comments