Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/uu/paste/locales/en-US.ftl
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
paste-about = Write lines consisting of the sequentially corresponding lines from each
FILE, separated by TABs, to standard output.
paste-usage = paste [OPTIONS] [FILE]...

# Help messages
paste-help-serial = paste one file at a time instead of in parallel
paste-help-delimiter = reuse characters from LIST instead of TABs
paste-help-zero-terminated = line delimiter is NUL, not newline

# Error messages
paste-error-delimiter-unescaped-backslash = delimiter list ends with an unescaped backslash: { $delimiters }
paste-error-stdin-borrow = failed to access standard input: { $error }
12 changes: 12 additions & 0 deletions src/uu/paste/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
paste-about = Écrire les lignes composées des lignes correspondantes séquentiellement de chaque
FICHIER, séparées par des TABs, vers la sortie standard.
paste-usage = paste [OPTIONS] [FICHIER]...

# Messages d'aide
paste-help-serial = coller un fichier à la fois au lieu d'en parallèle
paste-help-delimiter = réutiliser les caractères de LISTE au lieu des TABs
paste-help-zero-terminated = le délimiteur de ligne est NUL, pas une nouvelle ligne

# Messages d'erreur
paste-error-delimiter-unescaped-backslash = la liste de délimiteurs se termine par une barre oblique inverse non échappée : { $delimiters }
paste-error-stdin-borrow = échec de l'accès à l'entrée standard : { $error }
25 changes: 18 additions & 7 deletions src/uu/paste/src/paste.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use clap::{Arg, ArgAction, Command};
use std::cell::{OnceCell, RefCell};
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufRead, BufReader, Stdin, Write, stdin, stdout};
use std::iter::Cycle;
Expand All @@ -13,8 +14,7 @@
use uucore::error::{UResult, USimpleError};
use uucore::format_usage;
use uucore::line_ending::LineEnding;

use uucore::locale::get_message;
use uucore::locale::{get_message, get_message_with_args};

mod options {
pub const DELIMITER: &str = "delimiters";
Expand Down Expand Up @@ -49,14 +49,14 @@
Arg::new(options::SERIAL)
.long(options::SERIAL)
.short('s')
.help("paste one file at a time instead of in parallel")
.help(get_message("paste-help-serial"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::DELIMITER)
.long(options::DELIMITER)
.short('d')
.help("reuse characters from LIST instead of TABs")
.help(get_message("paste-help-delimiter"))
.value_name("LIST")
.default_value("\t")
.hide_default_value(true),
Expand All @@ -72,7 +72,7 @@
Arg::new(options::ZERO_TERMINATED)
.long(options::ZERO_TERMINATED)
.short('z')
.help("line delimiter is NUL, not newline")
.help(get_message("paste-help-zero-terminated"))
.action(ArgAction::SetTrue),
)
}
Expand Down Expand Up @@ -237,7 +237,10 @@
None => {
return Err(USimpleError::new(
1,
format!("delimiter list ends with an unescaped backslash: {delimiters}"),
get_message_with_args(
"paste-error-delimiter-unescaped-backslash",
HashMap::from([("delimiters".to_string(), delimiters.to_string())]),
),
));
}
},
Expand Down Expand Up @@ -365,7 +368,15 @@
InputSource::File(bu) => bu.read_until(byte, buf)?,
InputSource::StandardInput(rc) => rc
.try_borrow()
.map_err(|bo| USimpleError::new(1, format!("{bo}")))?
.map_err(|bo| {
USimpleError::new(
1,
get_message_with_args(
"paste-error-stdin-borrow",
HashMap::from([("error".to_string(), bo.to_string())]),
),
)
})?

Check warning on line 379 in src/uu/paste/src/paste.rs

View check run for this annotation

Codecov / codecov/patch

src/uu/paste/src/paste.rs#L372-L379

Added lines #L372 - L379 were not covered by tests
.lock()
.read_until(byte, buf)?,
};
Expand Down
Loading