5
5
6
6
use clap:: { Arg , ArgAction , Command } ;
7
7
use std:: cell:: { OnceCell , RefCell } ;
8
+ use std:: collections:: HashMap ;
8
9
use std:: fs:: File ;
9
10
use std:: io:: { BufRead , BufReader , Stdin , Write , stdin, stdout} ;
10
11
use std:: iter:: Cycle ;
@@ -13,8 +14,7 @@ use std::slice::Iter;
13
14
use uucore:: error:: { UResult , USimpleError } ;
14
15
use uucore:: format_usage;
15
16
use uucore:: line_ending:: LineEnding ;
16
-
17
- use uucore:: locale:: get_message;
17
+ use uucore:: locale:: { get_message, get_message_with_args} ;
18
18
19
19
mod options {
20
20
pub const DELIMITER : & str = "delimiters" ;
@@ -49,14 +49,14 @@ pub fn uu_app() -> Command {
49
49
Arg :: new ( options:: SERIAL )
50
50
. long ( options:: SERIAL )
51
51
. short ( 's' )
52
- . help ( "paste one file at a time instead of in parallel" )
52
+ . help ( get_message ( "paste-help-serial" ) )
53
53
. action ( ArgAction :: SetTrue ) ,
54
54
)
55
55
. arg (
56
56
Arg :: new ( options:: DELIMITER )
57
57
. long ( options:: DELIMITER )
58
58
. short ( 'd' )
59
- . help ( "reuse characters from LIST instead of TABs" )
59
+ . help ( get_message ( "paste-help-delimiter" ) )
60
60
. value_name ( "LIST" )
61
61
. default_value ( "\t " )
62
62
. hide_default_value ( true ) ,
@@ -72,7 +72,7 @@ pub fn uu_app() -> Command {
72
72
Arg :: new ( options:: ZERO_TERMINATED )
73
73
. long ( options:: ZERO_TERMINATED )
74
74
. short ( 'z' )
75
- . help ( "line delimiter is NUL, not newline" )
75
+ . help ( get_message ( "paste-help-zero-terminated" ) )
76
76
. action ( ArgAction :: SetTrue ) ,
77
77
)
78
78
}
@@ -237,7 +237,10 @@ fn parse_delimiters(delimiters: &str) -> UResult<Box<[Box<[u8]>]>> {
237
237
None => {
238
238
return Err ( USimpleError :: new (
239
239
1 ,
240
- format ! ( "delimiter list ends with an unescaped backslash: {delimiters}" ) ,
240
+ get_message_with_args (
241
+ "paste-error-delimiter-unescaped-backslash" ,
242
+ HashMap :: from ( [ ( "delimiters" . to_string ( ) , delimiters. to_string ( ) ) ] ) ,
243
+ ) ,
241
244
) ) ;
242
245
}
243
246
} ,
@@ -365,7 +368,15 @@ impl InputSource {
365
368
InputSource :: File ( bu) => bu. read_until ( byte, buf) ?,
366
369
InputSource :: StandardInput ( rc) => rc
367
370
. try_borrow ( )
368
- . map_err ( |bo| USimpleError :: new ( 1 , format ! ( "{bo}" ) ) ) ?
371
+ . map_err ( |bo| {
372
+ USimpleError :: new (
373
+ 1 ,
374
+ get_message_with_args (
375
+ "paste-error-stdin-borrow" ,
376
+ HashMap :: from ( [ ( "error" . to_string ( ) , bo. to_string ( ) ) ] ) ,
377
+ ) ,
378
+ )
379
+ } ) ?
369
380
. lock ( )
370
381
. read_until ( byte, buf) ?,
371
382
} ;
0 commit comments