@@ -65,7 +65,7 @@ impl fmt::Display for Info {
65
65
writeln ! (
66
66
buffer,
67
67
"{}{}" ,
68
- get_formatted_info_label( "Project: " , color, self . bold_enabled ) ,
68
+ self . get_formatted_info_label( "Project: " , color) ,
69
69
self . project_name
70
70
) ?;
71
71
}
@@ -74,7 +74,7 @@ impl fmt::Display for Info {
74
74
writeln ! (
75
75
buffer,
76
76
"{}{}" ,
77
- get_formatted_info_label( "HEAD: " , color, self . bold_enabled ) ,
77
+ self . get_formatted_info_label( "HEAD: " , color) ,
78
78
self . current_commit
79
79
) ?;
80
80
}
@@ -83,7 +83,7 @@ impl fmt::Display for Info {
83
83
writeln ! (
84
84
buffer,
85
85
"{}{}" ,
86
- get_formatted_info_label( "Version: " , color, self . bold_enabled ) ,
86
+ self . get_formatted_info_label( "Version: " , color) ,
87
87
self . version
88
88
) ?;
89
89
}
@@ -92,7 +92,7 @@ impl fmt::Display for Info {
92
92
writeln ! (
93
93
buffer,
94
94
"{}{}" ,
95
- get_formatted_info_label( "Created: " , color, self . bold_enabled ) ,
95
+ self . get_formatted_info_label( "Created: " , color) ,
96
96
self . creation_date
97
97
) ?;
98
98
}
@@ -113,15 +113,15 @@ impl fmt::Display for Info {
113
113
writeln ! (
114
114
buffer,
115
115
"{}{}" ,
116
- get_formatted_info_label( title, color, self . bold_enabled ) ,
116
+ self . get_formatted_info_label( title, color) ,
117
117
s
118
118
) ?;
119
119
} else {
120
120
let title = "Language: " ;
121
121
writeln ! (
122
122
buffer,
123
123
"{}{}" ,
124
- get_formatted_info_label( title, color, self . bold_enabled ) ,
124
+ self . get_formatted_info_label( title, color) ,
125
125
self . dominant_language
126
126
) ?;
127
127
} ;
@@ -137,7 +137,7 @@ impl fmt::Display for Info {
137
137
writeln ! (
138
138
buffer,
139
139
"{}{}% {} {}" ,
140
- get_formatted_info_label( title, color, self . bold_enabled ) ,
140
+ self . get_formatted_info_label( title, color) ,
141
141
self . authors[ 0 ] . 2 ,
142
142
self . authors[ 0 ] . 0 ,
143
143
self . authors[ 0 ] . 1
@@ -149,7 +149,7 @@ impl fmt::Display for Info {
149
149
writeln ! (
150
150
buffer,
151
151
"{}{}% {} {}" ,
152
- get_formatted_info_label( & title, color, self . bold_enabled ) ,
152
+ self . get_formatted_info_label( & title, color) ,
153
153
author. 2 ,
154
154
author. 0 ,
155
155
author. 1
@@ -161,7 +161,7 @@ impl fmt::Display for Info {
161
161
writeln ! (
162
162
buffer,
163
163
"{}{}" ,
164
- get_formatted_info_label( "Last change: " , color, self . bold_enabled ) ,
164
+ self . get_formatted_info_label( "Last change: " , color) ,
165
165
self . last_change
166
166
) ?;
167
167
}
@@ -170,7 +170,7 @@ impl fmt::Display for Info {
170
170
writeln ! (
171
171
buffer,
172
172
"{}{}" ,
173
- get_formatted_info_label( "Repo: " , color, self . bold_enabled ) ,
173
+ self . get_formatted_info_label( "Repo: " , color) ,
174
174
self . repo
175
175
) ?;
176
176
}
@@ -179,7 +179,7 @@ impl fmt::Display for Info {
179
179
writeln ! (
180
180
buffer,
181
181
"{}{}" ,
182
- get_formatted_info_label( "Commits: " , color, self . bold_enabled ) ,
182
+ self . get_formatted_info_label( "Commits: " , color) ,
183
183
self . commits
184
184
) ?;
185
185
}
@@ -188,7 +188,7 @@ impl fmt::Display for Info {
188
188
writeln ! (
189
189
buffer,
190
190
"{}{}" ,
191
- get_formatted_info_label( "Lines of code: " , color, self . bold_enabled ) ,
191
+ self . get_formatted_info_label( "Lines of code: " , color) ,
192
192
self . number_of_lines
193
193
) ?;
194
194
}
@@ -197,7 +197,7 @@ impl fmt::Display for Info {
197
197
writeln ! (
198
198
buffer,
199
199
"{}{}" ,
200
- get_formatted_info_label( "Size: " , color, self . bold_enabled ) ,
200
+ self . get_formatted_info_label( "Size: " , color) ,
201
201
self . repo_size
202
202
) ?;
203
203
}
@@ -206,7 +206,7 @@ impl fmt::Display for Info {
206
206
writeln ! (
207
207
buffer,
208
208
"{}{}" ,
209
- get_formatted_info_label( "License: " , color, self . bold_enabled ) ,
209
+ self . get_formatted_info_label( "License: " , color) ,
210
210
self . license
211
211
) ?;
212
212
}
@@ -340,15 +340,6 @@ fn true_len(line: &str) -> usize {
340
340
. len ( )
341
341
}
342
342
343
- // Returns a formatted label with the desired color and boldness
344
- fn get_formatted_info_label ( label : & str , color : Color , bold : bool ) -> ColoredString {
345
- let mut formatted_label = label. color ( color) ;
346
- if bold {
347
- formatted_label = formatted_label. bold ( ) ;
348
- }
349
- formatted_label
350
- }
351
-
352
343
struct CommitInfo {
353
344
commit : Oid ,
354
345
refs : Vec < String > ,
@@ -1142,6 +1133,15 @@ impl Info {
1142
1133
}
1143
1134
}
1144
1135
1136
+ // Returns a formatted info label with the desired color and boldness
1137
+ fn get_formatted_info_label ( & self , label : & str , color : Color ) -> ColoredString {
1138
+ let mut formatted_label = label. color ( color) ;
1139
+ if self . bold_enabled {
1140
+ formatted_label = formatted_label. bold ( ) ;
1141
+ }
1142
+ formatted_label
1143
+ }
1144
+
1145
1145
fn colors ( & self ) -> Vec < Color > {
1146
1146
let language =
1147
1147
if let Language :: Unknown = self . custom_logo {
0 commit comments