@@ -16,32 +16,40 @@ using ecsact::cli::subcommand_stdout_message;
16
16
using ecsact::cli::success_message;
17
17
using ecsact::cli::warning_message;
18
18
19
+ #define COLOR_RED " \e[0;31m"
20
+ #define COLOR_GRN " \e[0;32m"
21
+ #define COLOR_YEL " \e[0;33m"
22
+ #define COLOR_BLU " \e[0;34m"
23
+ #define COLOR_MAG " \e[0;35m"
24
+ #define COLOR_CYN " \e[0;36m"
25
+
26
+ #define COLOR_RESET " \e[0m"
27
+
19
28
namespace {
20
29
auto print_text_report (const alert_message& msg) -> void {
21
30
std::cout << std::format ( //
22
- " [ ALERT] {}\n " ,
31
+ COLOR_RED " ALERT: " COLOR_RESET " {}\n " ,
23
32
msg.content
24
33
);
25
34
}
26
35
27
36
auto print_text_report (const info_message& msg) -> void {
28
37
std::cout << std::format ( //
29
- " [ INFO] {}\n " ,
38
+ COLOR_GRN " INFO: " COLOR_RESET " {}\n " ,
30
39
msg.content
31
40
);
32
41
}
33
42
34
43
auto print_text_report (const error_message& msg) -> void {
35
44
std::cout << std::format ( //
36
- " [ ERROR] {}\n " ,
45
+ COLOR_RED " ERROR: " COLOR_RESET " {}\n " ,
37
46
msg.content
38
47
);
39
48
}
40
49
41
50
auto print_text_report (const ecsact_error_message& msg) -> void {
42
51
std::cerr << std::format ( //
43
- " [ERROR] {}:{}:{}\n "
44
- " {}\n " ,
52
+ COLOR_RED " ERROR:" COLOR_RESET " {}:{}:{}\n {}\n " ,
45
53
msg.ecsact_source_path ,
46
54
msg.line ,
47
55
msg.character ,
@@ -51,31 +59,33 @@ auto print_text_report(const ecsact_error_message& msg) -> void {
51
59
52
60
auto print_text_report (const warning_message& msg) -> void {
53
61
std::cout << std::format ( //
54
- " [ WARNING] {}\n " ,
62
+ COLOR_YEL " WARNING: " COLOR_RESET " {}\n " ,
55
63
msg.content
56
64
);
57
65
}
58
66
59
67
auto print_text_report (const success_message& msg) -> void {
60
68
std::cout << std::format ( //
61
- " [ SUCCESS] {}\n " ,
69
+ COLOR_GRN " SUCCESS: " COLOR_RESET " {}\n " ,
62
70
msg.content
63
71
);
64
72
}
65
73
66
74
auto print_text_report (const module_methods_message& msg) -> void {
67
- std::cout << " [Module Methods for " << msg.module_name << " ] \n " ;
75
+ std::cout << " MODULE METHODS FOR " << msg.module_name << " : \n " ;
68
76
for (auto & method : msg.methods ) {
69
77
std::cout //
70
- << " " << (method.available ? " YES " : " NO " ) << method. method_name
71
- << " \n " ;
78
+ << " " << (method.available ? COLOR_GRN " YES " : COLOR_RED " NO " )
79
+ << COLOR_RESET << method. method_name << " \n " ;
72
80
}
73
81
}
74
82
75
83
auto print_text_report (const subcommand_start_message& msg) -> void {
76
- std::cout //
77
- << " [SUBCOMMAND START id=(" << std::to_string (msg.id ) << " )] "
78
- << msg.executable << " " ;
84
+ std::cout << std::format ( //
85
+ COLOR_BLU " SUBCOMMAND({}) START >>" COLOR_RESET " {} " ,
86
+ msg.id ,
87
+ msg.executable
88
+ );
79
89
for (auto & arg : msg.arguments ) {
80
90
std::cout << arg << " " ;
81
91
}
@@ -84,31 +94,31 @@ auto print_text_report(const subcommand_start_message& msg) -> void {
84
94
85
95
auto print_text_report (const subcommand_stdout_message& msg) -> void {
86
96
std::cout << std::format ( //
87
- " [ SUBCOMMAND STDOUT id= ({})] {}\n " ,
97
+ COLOR_BLU " SUBCOMMAND({}) STDOUT: " COLOR_RESET " {}\n " ,
88
98
msg.id ,
89
99
msg.line
90
100
);
91
101
}
92
102
93
103
auto print_text_report (const subcommand_stderr_message& msg) -> void {
94
104
std::cout << std::format ( //
95
- " [ SUBCOMMAND STDERR id= ({})] {}\n " ,
105
+ COLOR_RED " SUBCOMMAND({}) STDERR: " COLOR_RESET " {}\n " ,
96
106
msg.id ,
97
107
msg.line
98
108
);
99
109
}
100
110
101
111
auto print_text_report (const subcommand_progress_message& msg) -> void {
102
112
std::cout << std::format ( //
103
- " [ SUBCOMMAND PROG id= ({})] {}\n " ,
113
+ COLOR_BLU " SUBCOMMAND({}) PROG: " COLOR_RESET " {}\n " ,
104
114
msg.id ,
105
115
msg.description
106
116
);
107
117
}
108
118
109
119
auto print_text_report (const subcommand_end_message& msg) -> void {
110
120
std::cout << std::format ( //
111
- " [ SUBCOMMAND END id=({})] exit code {}\n " ,
121
+ COLOR_BLU " SUBCOMMAND({}) END << " COLOR_RESET " exit code {}\n " ,
112
122
msg.id ,
113
123
msg.exit_code
114
124
);
0 commit comments