mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tac: fix error message (#9942)
* tac: fix error message * tac: Remove obsolete error messages from locales
This commit is contained in:
@@ -6,7 +6,7 @@ tac-help-separator = use STRING as the separator instead of newline
|
||||
|
||||
# Error messages
|
||||
tac-error-invalid-regex = invalid regular expression: { $error }
|
||||
tac-error-invalid-argument = { $argument }: read error: Invalid argument
|
||||
tac-error-invalid-directory-argument = { $argument }: read error: Is a directory
|
||||
tac-error-file-not-found = failed to open { $filename } for reading: No such file or directory
|
||||
tac-error-read-error = failed to read from { $filename }: { $error }
|
||||
tac-error-write-error = failed to write to stdout: { $error }
|
||||
|
||||
@@ -6,7 +6,7 @@ tac-help-separator = utiliser CHAÎNE comme séparateur au lieu du saut de ligne
|
||||
|
||||
# Messages d'erreur
|
||||
tac-error-invalid-regex = expression régulière invalide : { $error }
|
||||
tac-error-invalid-argument = { $argument } : erreur de lecture : Argument invalide
|
||||
tac-error-file-not-found = échec de l'ouverture de { $filename } en lecture : Aucun fichier ou répertoire de ce type
|
||||
tac-error-read-error = échec de la lecture depuis { $filename } : { $error }
|
||||
tac-error-write-error = échec de l'écriture vers stdout : { $error }
|
||||
tac-error-invalid-directory-argument = { $argument } : erreur de lecture : Est un répertoire
|
||||
|
||||
@@ -15,9 +15,9 @@ pub enum TacError {
|
||||
/// A regular expression given by the user is invalid.
|
||||
#[error("{}", translate!("tac-error-invalid-regex", "error" => .0))]
|
||||
InvalidRegex(regex::Error),
|
||||
/// An argument to tac is invalid.
|
||||
#[error("{}", translate!("tac-error-invalid-argument", "argument" => .0.maybe_quote()))]
|
||||
InvalidArgument(OsString),
|
||||
/// The argument to tac is a directory.
|
||||
#[error("{}", translate!("tac-error-invalid-directory-argument", "argument" => .0.maybe_quote()))]
|
||||
InvalidDirectoryArgument(OsString),
|
||||
/// The specified file is not found on the filesystem.
|
||||
#[error("{}", translate!("tac-error-file-not-found", "filename" => .0.quote()))]
|
||||
FileNotFound(OsString),
|
||||
|
||||
@@ -253,7 +253,8 @@ fn tac(filenames: &[OsString], before: bool, regex: bool, separator: &str) -> UR
|
||||
} else {
|
||||
let path = Path::new(filename);
|
||||
if path.is_dir() {
|
||||
let e: Box<dyn UError> = TacError::InvalidArgument(filename.clone()).into();
|
||||
let e: Box<dyn UError> =
|
||||
TacError::InvalidDirectoryArgument(filename.clone()).into();
|
||||
show!(e);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ fn test_invalid_input() {
|
||||
.ucmd()
|
||||
.arg("a")
|
||||
.fails()
|
||||
.stderr_contains("a: read error: Invalid argument");
|
||||
.stderr_contains("a: read error: Is a directory");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user