@@ -309,14 +309,6 @@ mod options {
309
309
}
310
310
311
311
pub fn uu_app_common ( ) -> Command {
312
- #[ cfg( windows) ]
313
- const BINARY_HELP : & str = "read or check in binary mode (default)" ;
314
- #[ cfg( not( windows) ) ]
315
- const BINARY_HELP : & str = "read in binary mode" ;
316
- #[ cfg( windows) ]
317
- const TEXT_HELP : & str = "read or check in text mode" ;
318
- #[ cfg( not( windows) ) ]
319
- const TEXT_HELP : & str = "read in text mode (default)" ;
320
312
Command :: new ( uucore:: util_name ( ) )
321
313
. version ( uucore:: crate_version!( ) )
322
314
. about ( get_message ( "hashsum-about" ) )
@@ -327,73 +319,91 @@ pub fn uu_app_common() -> Command {
327
319
Arg :: new ( options:: BINARY )
328
320
. short ( 'b' )
329
321
. long ( "binary" )
330
- . help ( BINARY_HELP )
322
+ . help ( {
323
+ #[ cfg( windows) ]
324
+ {
325
+ get_message ( "hashsum-help-binary-windows" )
326
+ }
327
+ #[ cfg( not( windows) ) ]
328
+ {
329
+ get_message ( "hashsum-help-binary-other" )
330
+ }
331
+ } )
331
332
. action ( ArgAction :: SetTrue ) ,
332
333
)
333
334
. arg (
334
335
Arg :: new ( options:: CHECK )
335
336
. short ( 'c' )
336
337
. long ( "check" )
337
- . help ( "read hashsums from the FILEs and check them" )
338
+ . help ( get_message ( "hashsum-help- check" ) )
338
339
. action ( ArgAction :: SetTrue )
339
340
. conflicts_with ( "tag" ) ,
340
341
)
341
342
. arg (
342
343
Arg :: new ( options:: TAG )
343
344
. long ( "tag" )
344
- . help ( "create a BSD-style checksum" )
345
+ . help ( get_message ( "hashsum-help-tag" ) )
345
346
. action ( ArgAction :: SetTrue )
346
347
. conflicts_with ( "text" ) ,
347
348
)
348
349
. arg (
349
350
Arg :: new ( options:: TEXT )
350
351
. short ( 't' )
351
352
. long ( "text" )
352
- . help ( TEXT_HELP )
353
+ . help ( {
354
+ #[ cfg( windows) ]
355
+ {
356
+ get_message ( "hashsum-help-text-windows" )
357
+ }
358
+ #[ cfg( not( windows) ) ]
359
+ {
360
+ get_message ( "hashsum-help-text-other" )
361
+ }
362
+ } )
353
363
. conflicts_with ( "binary" )
354
364
. action ( ArgAction :: SetTrue ) ,
355
365
)
356
366
. arg (
357
367
Arg :: new ( options:: QUIET )
358
368
. short ( 'q' )
359
369
. long ( options:: QUIET )
360
- . help ( "don't print OK for each successfully verified file" )
370
+ . help ( get_message ( "hashsum-help-quiet" ) )
361
371
. action ( ArgAction :: SetTrue )
362
372
. overrides_with_all ( [ options:: STATUS , options:: WARN ] ) ,
363
373
)
364
374
. arg (
365
375
Arg :: new ( options:: STATUS )
366
376
. short ( 's' )
367
377
. long ( "status" )
368
- . help ( "don't output anything, status code shows success" )
378
+ . help ( get_message ( "hashsum-help- status" ) )
369
379
. action ( ArgAction :: SetTrue )
370
380
. overrides_with_all ( [ options:: QUIET , options:: WARN ] ) ,
371
381
)
372
382
. arg (
373
383
Arg :: new ( options:: STRICT )
374
384
. long ( "strict" )
375
- . help ( "exit non-zero for improperly formatted checksum lines" )
385
+ . help ( get_message ( "hashsum-help-strict" ) )
376
386
. action ( ArgAction :: SetTrue ) ,
377
387
)
378
388
. arg (
379
389
Arg :: new ( "ignore-missing" )
380
390
. long ( "ignore-missing" )
381
- . help ( "don't fail or report status for missing files" )
391
+ . help ( get_message ( "hashsum-help-ignore- missing" ) )
382
392
. action ( ArgAction :: SetTrue ) ,
383
393
)
384
394
. arg (
385
395
Arg :: new ( options:: WARN )
386
396
. short ( 'w' )
387
397
. long ( "warn" )
388
- . help ( " warn about improperly formatted checksum lines" )
398
+ . help ( get_message ( "hashsum-help- warn" ) )
389
399
. action ( ArgAction :: SetTrue )
390
400
. overrides_with_all ( [ options:: QUIET , options:: STATUS ] ) ,
391
401
)
392
402
. arg (
393
403
Arg :: new ( "zero" )
394
404
. short ( 'z' )
395
405
. long ( "zero" )
396
- . help ( "end each output line with NUL, not newline" )
406
+ . help ( get_message ( "hashsum-help-zero" ) )
397
407
. action ( ArgAction :: SetTrue ) ,
398
408
)
399
409
. arg (
@@ -416,10 +426,7 @@ fn uu_app_opt_length(command: Command) -> Command {
416
426
. long ( options:: LENGTH )
417
427
. value_parser ( value_parser ! ( usize ) )
418
428
. short ( 'l' )
419
- . help (
420
- "digest length in bits; must not exceed the max for the blake2 algorithm \
421
- and must be a multiple of 8",
422
- )
429
+ . help ( get_message ( "hashsum-help-length" ) )
423
430
. overrides_with ( options:: LENGTH )
424
431
. action ( ArgAction :: Set ) ,
425
432
)
@@ -433,7 +440,7 @@ fn uu_app_b3sum_opts(command: Command) -> Command {
433
440
command. arg (
434
441
Arg :: new ( "no-names" )
435
442
. long ( "no-names" )
436
- . help ( "Omits filenames in the output (option not present in GNU/Coreutils)" )
443
+ . help ( get_message ( "hashsum-help-no-names" ) )
437
444
. action ( ArgAction :: SetTrue ) ,
438
445
)
439
446
}
@@ -447,7 +454,7 @@ fn uu_app_opt_bits(command: Command) -> Command {
447
454
command. arg (
448
455
Arg :: new ( "bits" )
449
456
. long ( "bits" )
450
- . help ( "set the size of the output (only for SHAKE)" )
457
+ . help ( get_message ( "hashsum-help-bits" ) )
451
458
. value_name ( "BITS" )
452
459
// XXX: should we actually use validators? they're not particularly efficient
453
460
. value_parser ( parse_bit_num) ,
@@ -457,34 +464,28 @@ fn uu_app_opt_bits(command: Command) -> Command {
457
464
pub fn uu_app_custom ( ) -> Command {
458
465
let mut command = uu_app_b3sum_opts ( uu_app_opt_bits ( uu_app_common ( ) ) ) ;
459
466
let algorithms = & [
460
- ( "md5" , "work with MD5" ) ,
461
- ( "sha1" , "work with SHA1" ) ,
462
- ( "sha224" , "work with SHA224" ) ,
463
- ( "sha256" , "work with SHA256" ) ,
464
- ( "sha384" , "work with SHA384" ) ,
465
- ( "sha512" , "work with SHA512" ) ,
466
- ( "sha3" , "work with SHA3" ) ,
467
- ( "sha3-224" , "work with SHA3-224" ) ,
468
- ( "sha3-256" , "work with SHA3-256" ) ,
469
- ( "sha3-384" , "work with SHA3-384" ) ,
470
- ( "sha3-512" , "work with SHA3-512" ) ,
471
- (
472
- "shake128" ,
473
- "work with SHAKE128 using BITS for the output size" ,
474
- ) ,
475
- (
476
- "shake256" ,
477
- "work with SHAKE256 using BITS for the output size" ,
478
- ) ,
479
- ( "b2sum" , "work with BLAKE2" ) ,
480
- ( "b3sum" , "work with BLAKE3" ) ,
467
+ ( "md5" , get_message ( "hashsum-help-md5" ) ) ,
468
+ ( "sha1" , get_message ( "hashsum-help-sha1" ) ) ,
469
+ ( "sha224" , get_message ( "hashsum-help-sha224" ) ) ,
470
+ ( "sha256" , get_message ( "hashsum-help-sha256" ) ) ,
471
+ ( "sha384" , get_message ( "hashsum-help-sha384" ) ) ,
472
+ ( "sha512" , get_message ( "hashsum-help-sha512" ) ) ,
473
+ ( "sha3" , get_message ( "hashsum-help-sha3" ) ) ,
474
+ ( "sha3-224" , get_message ( "hashsum-help-sha3-224" ) ) ,
475
+ ( "sha3-256" , get_message ( "hashsum-help-sha3-256" ) ) ,
476
+ ( "sha3-384" , get_message ( "hashsum-help-sha3-384" ) ) ,
477
+ ( "sha3-512" , get_message ( "hashsum-help-sha3-512" ) ) ,
478
+ ( "shake128" , get_message ( "hashsum-help-shake128" ) ) ,
479
+ ( "shake256" , get_message ( "hashsum-help-shake256" ) ) ,
480
+ ( "b2sum" , get_message ( "hashsum-help-b2sum" ) ) ,
481
+ ( "b3sum" , get_message ( "hashsum-help-b3sum" ) ) ,
481
482
] ;
482
483
483
484
for ( name, desc) in algorithms {
484
485
command = command. arg (
485
486
Arg :: new ( * name)
486
487
. long ( name)
487
- . help ( * desc)
488
+ . help ( desc)
488
489
. action ( ArgAction :: SetTrue ) ,
489
490
) ;
490
491
}
@@ -549,7 +550,7 @@ where
549
550
options. binary ,
550
551
options. output_bits ,
551
552
)
552
- . map_err_context ( || " failed to read input". to_string ( ) ) ?;
553
+ . map_err_context ( || get_message ( "hashsum-error- failed-to- read- input") ) ?;
553
554
let ( escaped_filename, prefix) = escape_filename ( filename) ;
554
555
if options. tag {
555
556
if options. algoname == "blake2b" {
0 commit comments