@@ -114,6 +114,7 @@ fn main() -> Result<()> {
114
114
. about ( crate_description ! ( ) )
115
115
. arg (
116
116
Arg :: with_name ( "directory" )
117
+ . help ( "Run as if git was started in <directory> instead of the current working directory." )
117
118
. short ( "d" )
118
119
. long ( "dir" )
119
120
. takes_value ( true )
@@ -131,40 +132,32 @@ fn main() -> Result<()> {
131
132
. collect :: < Vec < & str > > ( ) ,
132
133
)
133
134
. case_insensitive ( true )
134
- . help ( "Overrides showing the dominant language ascii logo ." ) ,
135
+ . help ( "Which language's ascii art to print ." ) ,
135
136
)
136
137
. arg (
137
- Arg :: with_name ( "disable-field " )
138
- . short ( "f ")
139
- . long ( "disable-field ")
138
+ Arg :: with_name ( "disable-fields " )
139
+ . long ( "disable-fields ")
140
+ . short ( "D ")
140
141
. multiple ( true )
141
142
. takes_value ( true )
142
143
. case_insensitive ( true )
143
- . default_value ( "" )
144
- . hide_default_value ( true )
145
- . help ( & format ! (
146
- "Disable fields to show\n Possible values: {:?}" ,
144
+ . help ( "Allows you to disable an info line from appearing in the output." )
145
+ . possible_values (
147
146
& InfoFields :: iter ( )
148
147
. take ( InfoFields :: count ( ) - 1 )
149
148
. map ( |field| field. into ( ) )
150
149
. collect :: < Vec < & str > > ( )
151
150
. as_slice ( )
152
- ) ) ,
151
+ ) ,
153
152
)
154
153
. arg (
155
- Arg :: with_name ( "colors" )
154
+ Arg :: with_name ( "ascii- colors" )
156
155
. short ( "c" )
157
- . long ( "colors" )
156
+ . long ( "ascii- colors" )
158
157
. multiple ( true )
159
158
. takes_value ( true )
160
- . possible_values ( & [
161
- "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" , "11" , "12" , "13" , "14" ,
162
- "15" ,
163
- ] )
164
- . hide_possible_values ( true )
165
159
. help ( & format ! (
166
- "Specifies a preferred color set. Unspecified colors will remain as default.
167
- Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]" ,
160
+ "Colors to print the ascii art. Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]" ,
168
161
"0" . black( ) ,
169
162
"1" . red( ) ,
170
163
"2" . green( ) ,
@@ -182,13 +175,12 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]",
182
175
"14" . bright_cyan( ) ,
183
176
"15" . bright_white( ) ,
184
177
) ) ,
185
- )
186
- . arg (
187
- Arg :: with_name ( "no-bold" )
188
- . short ( "b" )
189
- . long ( "no-bold" )
190
- . help ( "Turns off bold formatting for the logo and all labels" ) ,
191
- )
178
+ )
179
+ . arg (
180
+ Arg :: with_name ( "no-bold" )
181
+ . long ( "no-bold" )
182
+ . help ( "Turns off bold formatting." ) ,
183
+ )
192
184
. arg (
193
185
Arg :: with_name ( "languages" )
194
186
. short ( "l" )
@@ -200,24 +192,22 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]",
200
192
. short ( "i" )
201
193
. long ( "image" )
202
194
. takes_value ( true )
203
- . help ( "Sets a custom image to use instead of the ascii logo " ) ,
195
+ . help ( "Which image to use. Possible values: [/path/to/img] " ) ,
204
196
)
205
197
. arg (
206
198
Arg :: with_name ( "image-backend" )
207
199
. long ( "image-backend" )
208
200
. takes_value ( true )
209
201
. possible_values ( & possible_backends)
210
- . help ( "Overrides image backend detection " ) ,
202
+ . help ( "Which image backend to use. " ) ,
211
203
)
212
204
. arg (
213
- Arg :: with_name ( "no-merges" )
214
- . short ( "m" )
215
- . long ( "no-merges" )
216
- . help ( "Prevents merge commits from being counted" ) ,
205
+ Arg :: with_name ( "no-merges-commits" )
206
+ . long ( "no-merge-commits" )
207
+ . help ( "Ignore merge commits" ) ,
217
208
)
218
209
. arg (
219
210
Arg :: with_name ( "no-color-blocks" )
220
- . short ( "k" )
221
211
. long ( "no-color-blocks" )
222
212
. help ( "Hide the color blocks" ) ,
223
213
)
@@ -226,7 +216,8 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]",
226
216
. short ( "A" )
227
217
. long ( "authors-number" )
228
218
. takes_value ( true )
229
- . help ( "Defines the number of authors to be shown" ) ,
219
+ . default_value ( "3" )
220
+ . help ( "Number of authors to be shown." ) ,
230
221
)
231
222
. get_matches ( ) ;
232
223
@@ -250,34 +241,36 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]",
250
241
..Default :: default ( )
251
242
} ;
252
243
253
- matches
254
- . values_of ( "disable-field" )
255
- . unwrap ( )
256
- . map ( String :: from)
257
- . for_each ( |field : String | {
258
- let item = InfoFields :: from_str ( field. to_lowercase ( ) . as_str ( ) )
259
- . unwrap_or ( InfoFields :: UnrecognizedField ) ;
260
-
261
- match item {
262
- InfoFields :: GitInfo => disable_fields. git_info = true ,
263
- InfoFields :: Project => disable_fields. project = true ,
264
- InfoFields :: HEAD => disable_fields. head = true ,
265
- InfoFields :: Version => disable_fields. version = true ,
266
- InfoFields :: Created => disable_fields. created = true ,
267
- InfoFields :: Languages => disable_fields. languages = true ,
268
- InfoFields :: Authors => disable_fields. authors = true ,
269
- InfoFields :: LastChange => disable_fields. last_change = true ,
270
- InfoFields :: Repo => disable_fields. repo = true ,
271
- InfoFields :: Pending => disable_fields. pending = true ,
272
- InfoFields :: Commits => disable_fields. commits = true ,
273
- InfoFields :: LinesOfCode => disable_fields. lines_of_code = true ,
274
- InfoFields :: Size => disable_fields. size = true ,
275
- InfoFields :: License => disable_fields. license = true ,
276
- _ => ( ) ,
277
- }
278
- } ) ;
279
-
280
- let custom_colors: Vec < String > = if let Some ( values) = matches. values_of ( "colors" ) {
244
+ let fields_to_hide: Vec < String > = if let Some ( values) = matches. values_of ( "disable-fields" ) {
245
+ values. map ( String :: from) . collect ( )
246
+ } else {
247
+ Vec :: new ( )
248
+ } ;
249
+
250
+ for field in fields_to_hide. iter ( ) {
251
+ let item = InfoFields :: from_str ( field. to_lowercase ( ) . as_str ( ) )
252
+ . unwrap_or ( InfoFields :: UnrecognizedField ) ;
253
+
254
+ match item {
255
+ InfoFields :: GitInfo => disable_fields. git_info = true ,
256
+ InfoFields :: Project => disable_fields. project = true ,
257
+ InfoFields :: HEAD => disable_fields. head = true ,
258
+ InfoFields :: Version => disable_fields. version = true ,
259
+ InfoFields :: Created => disable_fields. created = true ,
260
+ InfoFields :: Languages => disable_fields. languages = true ,
261
+ InfoFields :: Authors => disable_fields. authors = true ,
262
+ InfoFields :: LastChange => disable_fields. last_change = true ,
263
+ InfoFields :: Repo => disable_fields. repo = true ,
264
+ InfoFields :: Pending => disable_fields. pending = true ,
265
+ InfoFields :: Commits => disable_fields. commits = true ,
266
+ InfoFields :: LinesOfCode => disable_fields. lines_of_code = true ,
267
+ InfoFields :: Size => disable_fields. size = true ,
268
+ InfoFields :: License => disable_fields. license = true ,
269
+ _ => ( ) ,
270
+ }
271
+ }
272
+
273
+ let custom_colors: Vec < String > = if let Some ( values) = matches. values_of ( "ascii-colors" ) {
281
274
values. map ( String :: from) . collect ( )
282
275
} else {
283
276
Vec :: new ( )
@@ -293,11 +286,14 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]",
293
286
let image_backend = if custom_image. is_some ( ) {
294
287
if let Some ( backend_name) = matches. value_of ( "image-backend" ) {
295
288
#[ cfg( target_os = "linux" ) ]
296
- let backend = Some ( match backend_name {
297
- "kitty" => Box :: new ( image_backends:: kitty:: KittyBackend :: new ( ) ) as Box < dyn ImageBackend > ,
298
- "sixel" => Box :: new ( image_backends:: sixel:: SixelBackend :: new ( ) ) as Box < dyn ImageBackend > ,
299
- _ => unreachable ! ( )
300
- } ) ;
289
+ let backend =
290
+ Some ( match backend_name {
291
+ "kitty" => Box :: new ( image_backends:: kitty:: KittyBackend :: new ( ) )
292
+ as Box < dyn ImageBackend > ,
293
+ "sixel" => Box :: new ( image_backends:: sixel:: SixelBackend :: new ( ) )
294
+ as Box < dyn ImageBackend > ,
295
+ _ => unreachable ! ( ) ,
296
+ } ) ;
301
297
#[ cfg( not( target_os = "linux" ) ) ]
302
298
let backend = None ;
303
299
backend
@@ -308,7 +304,7 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]",
308
304
None
309
305
} ;
310
306
311
- let no_merges = matches. is_present ( "no-merges" ) ;
307
+ let no_merges = matches. is_present ( "no-merges-commits " ) ;
312
308
313
309
let color_blocks_flag = matches. is_present ( "no-color-blocks" ) ;
314
310
0 commit comments