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
17 changes: 17 additions & 0 deletions src/uu/tee/locales/en-US.ftl
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
tee-about = Copy standard input to each FILE, and also to standard output.
tee-usage = tee [OPTION]... [FILE]...
tee-after-help = If a FILE is -, it refers to a file named - .

# Help messages
tee-help-help = Print help
tee-help-append = append to the given FILEs, do not overwrite
tee-help-ignore-interrupts = ignore interrupt signals (ignored on non-Unix platforms)
tee-help-ignore-pipe-errors = set write error behavior (ignored on non-Unix platforms)
tee-help-output-error = set write error behavior
tee-help-output-error-warn = produce warnings for errors writing to any output
tee-help-output-error-warn-nopipe = produce warnings for errors that are not pipe errors (ignored on non-unix platforms)
tee-help-output-error-exit = exit on write errors to any output
tee-help-output-error-exit-nopipe = exit on write errors to any output that are not pipe errors (equivalent to exit on non-unix platforms)

# Error messages
tee-error-stdin = stdin: { $error }

# Other messages
tee-standard-output = 'standard output'
20 changes: 20 additions & 0 deletions src/uu/tee/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tee-about = Copier l'entrée standard vers chaque FICHIER, et aussi vers la sortie standard.
tee-usage = tee [OPTION]... [FICHIER]...
tee-after-help = Si un FICHIER est -, il fait référence à un fichier nommé - .

# Messages d'aide
tee-help-help = Afficher l'aide
tee-help-append = ajouter aux FICHIERs donnés, ne pas écraser
tee-help-ignore-interrupts = ignorer les signaux d'interruption (ignoré sur les plateformes non-Unix)
tee-help-ignore-pipe-errors = définir le comportement d'erreur d'écriture (ignoré sur les plateformes non-Unix)
tee-help-output-error = définir le comportement d'erreur d'écriture
tee-help-output-error-warn = produire des avertissements pour les erreurs d'écriture vers toute sortie
tee-help-output-error-warn-nopipe = produire des avertissements pour les erreurs qui ne sont pas des erreurs de tube (ignoré sur les plateformes non-unix)
tee-help-output-error-exit = quitter en cas d'erreurs d'écriture vers toute sortie
tee-help-output-error-exit-nopipe = quitter en cas d'erreurs d'écriture vers toute sortie qui ne sont pas des erreurs de tube (équivalent à exit sur les plateformes non-unix)

# Messages d'erreur
tee-error-stdin = stdin : { $error }

# Autres messages
tee-standard-output = 'sortie standard'
34 changes: 20 additions & 14 deletions src/uu/tee/src/tee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
#[cfg(unix)]
use uucore::signals::{enable_pipe_errors, ignore_interrupts};

use uucore::locale::get_message;
use std::collections::HashMap;
use uucore::locale::{get_message, get_message_with_args};

mod options {
pub const APPEND: &str = "append";
Expand Down Expand Up @@ -106,21 +107,21 @@
Arg::new("--help")
.short('h')
.long("help")
.help("Print help")
.action(ArgAction::HelpLong)
.help(get_message("tee-help-help"))
.action(ArgAction::HelpLong),
)
.arg(
Arg::new(options::APPEND)
.long(options::APPEND)
.short('a')
.help("append to the given FILEs, do not overwrite")
.help(get_message("tee-help-append"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::IGNORE_INTERRUPTS)
.long(options::IGNORE_INTERRUPTS)
.short('i')
.help("ignore interrupt signals (ignored on non-Unix platforms)")
.help(get_message("tee-help-ignore-interrupts"))
.action(ArgAction::SetTrue),
)
.arg(
Expand All @@ -131,7 +132,7 @@
.arg(
Arg::new(options::IGNORE_PIPE_ERRORS)
.short('p')
.help("set write error behavior (ignored on non-Unix platforms)")
.help(get_message("tee-help-ignore-pipe-errors"))
.action(ArgAction::SetTrue),
)
.arg(
Expand All @@ -140,15 +141,14 @@
.require_equals(true)
.num_args(0..=1)
.value_parser(ShortcutValueParser::new([
PossibleValue::new("warn")
.help("produce warnings for errors writing to any output"),
PossibleValue::new("warn").help(get_message("tee-help-output-error-warn")),
PossibleValue::new("warn-nopipe")
.help("produce warnings for errors that are not pipe errors (ignored on non-unix platforms)"),
PossibleValue::new("exit").help("exit on write errors to any output"),
.help(get_message("tee-help-output-error-warn-nopipe")),
PossibleValue::new("exit").help(get_message("tee-help-output-error-exit")),
PossibleValue::new("exit-nopipe")
.help("exit on write errors to any output that are not pipe errors (equivalent to exit on non-unix platforms)"),
.help(get_message("tee-help-output-error-exit-nopipe")),
]))
.help("set write error behavior")
.help(get_message("tee-help-output-error")),
)
}

Expand All @@ -175,7 +175,7 @@
writers.insert(
0,
NamedWriter {
name: "'standard output'".to_owned(),
name: get_message("tee-standard-output"),
inner: Box::new(stdout()),
},
);
Expand Down Expand Up @@ -373,7 +373,13 @@
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
match self.inner.read(buf) {
Err(f) => {
show_error!("stdin: {f}");
show_error!(
"{}",
get_message_with_args(
"tee-error-stdin",
HashMap::from([("error".to_string(), f.to_string())])

Check warning on line 380 in src/uu/tee/src/tee.rs

View check run for this annotation

Codecov / codecov/patch

src/uu/tee/src/tee.rs#L376-L380

Added lines #L376 - L380 were not covered by tests
)
);
Err(f)
}
okay => okay,
Expand Down
Loading