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
37 changes: 37 additions & 0 deletions src/uu/hashsum/locales/en-US.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
hashsum-about = Compute and check message digests.
hashsum-usage = hashsum --<digest> [OPTIONS]... [FILE]...

# Help messages
hashsum-help-binary-windows = read or check in binary mode (default)
hashsum-help-binary-other = read in binary mode
hashsum-help-text-windows = read or check in text mode
hashsum-help-text-other = read in text mode (default)
hashsum-help-check = read hashsums from the FILEs and check them
hashsum-help-tag = create a BSD-style checksum
hashsum-help-quiet = don't print OK for each successfully verified file
hashsum-help-status = don't output anything, status code shows success
hashsum-help-strict = exit non-zero for improperly formatted checksum lines
hashsum-help-ignore-missing = don't fail or report status for missing files
hashsum-help-warn = warn about improperly formatted checksum lines
hashsum-help-zero = end each output line with NUL, not newline
hashsum-help-length = digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8
hashsum-help-no-names = Omits filenames in the output (option not present in GNU/Coreutils)
hashsum-help-bits = set the size of the output (only for SHAKE)

# Algorithm help messages
hashsum-help-md5 = work with MD5
hashsum-help-sha1 = work with SHA1
hashsum-help-sha224 = work with SHA224
hashsum-help-sha256 = work with SHA256
hashsum-help-sha384 = work with SHA384
hashsum-help-sha512 = work with SHA512
hashsum-help-sha3 = work with SHA3
hashsum-help-sha3-224 = work with SHA3-224
hashsum-help-sha3-256 = work with SHA3-256
hashsum-help-sha3-384 = work with SHA3-384
hashsum-help-sha3-512 = work with SHA3-512
hashsum-help-shake128 = work with SHAKE128 using BITS for the output size
hashsum-help-shake256 = work with SHAKE256 using BITS for the output size
hashsum-help-b2sum = work with BLAKE2
hashsum-help-b3sum = work with BLAKE3

# Error messages
hashsum-error-failed-to-read-input = failed to read input
39 changes: 39 additions & 0 deletions src/uu/hashsum/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
hashsum-about = Calculer et vérifier les empreintes de messages.
hashsum-usage = hashsum --<empreinte> [OPTION]... [FICHIER]...

# Messages d'aide
hashsum-help-binary-windows = lire ou vérifier en mode binaire (par défaut)
hashsum-help-binary-other = lire en mode binaire
hashsum-help-text-windows = lire ou vérifier en mode texte
hashsum-help-text-other = lire en mode texte (par défaut)
hashsum-help-check = lire les empreintes depuis les FICHIERs et les vérifier
hashsum-help-tag = créer une somme de contrôle de style BSD
hashsum-help-quiet = ne pas afficher OK pour chaque fichier vérifié avec succès
hashsum-help-status = ne rien afficher, le code de statut indique le succès
hashsum-help-strict = sortir avec un code non-zéro pour les lignes de somme de contrôle mal formatées
hashsum-help-ignore-missing = ne pas échouer ou rapporter le statut pour les fichiers manquants
hashsum-help-warn = avertir des lignes de somme de contrôle mal formatées
hashsum-help-zero = terminer chaque ligne de sortie avec NUL, pas de retour à la ligne
hashsum-help-length = longueur de l'empreinte en bits ; ne doit pas dépasser le maximum pour l'algorithme blake2 et doit être un multiple de 8
hashsum-help-no-names = Omet les noms de fichiers dans la sortie (option non présente dans GNU/Coreutils)
hashsum-help-bits = définir la taille de la sortie (uniquement pour SHAKE)

# Messages d'aide des algorithmes
hashsum-help-md5 = travailler avec MD5
hashsum-help-sha1 = travailler avec SHA1
hashsum-help-sha224 = travailler avec SHA224
hashsum-help-sha256 = travailler avec SHA256
hashsum-help-sha384 = travailler avec SHA384
hashsum-help-sha512 = travailler avec SHA512
hashsum-help-sha3 = travailler avec SHA3
hashsum-help-sha3-224 = travailler avec SHA3-224
hashsum-help-sha3-256 = travailler avec SHA3-256
hashsum-help-sha3-384 = travailler avec SHA3-384
hashsum-help-sha3-512 = travailler avec SHA3-512
hashsum-help-shake128 = travailler avec SHAKE128 en utilisant BITS pour la taille de sortie
hashsum-help-shake256 = travailler avec SHAKE256 en utilisant BITS pour la taille de sortie
hashsum-help-b2sum = travailler avec BLAKE2
hashsum-help-b3sum = travailler avec BLAKE3

# Messages d'erreur
hashsum-error-failed-to-read-input = échec de la lecture de l'entrée
95 changes: 48 additions & 47 deletions src/uu/hashsum/src/hashsum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,6 @@ mod options {
}

pub fn uu_app_common() -> Command {
#[cfg(windows)]
const BINARY_HELP: &str = "read or check in binary mode (default)";
#[cfg(not(windows))]
const BINARY_HELP: &str = "read in binary mode";
#[cfg(windows)]
const TEXT_HELP: &str = "read or check in text mode";
#[cfg(not(windows))]
const TEXT_HELP: &str = "read in text mode (default)";
Command::new(uucore::util_name())
.version(uucore::crate_version!())
.about(get_message("hashsum-about"))
Expand All @@ -327,73 +319,91 @@ pub fn uu_app_common() -> Command {
Arg::new(options::BINARY)
.short('b')
.long("binary")
.help(BINARY_HELP)
.help({
#[cfg(windows)]
{
get_message("hashsum-help-binary-windows")
}
#[cfg(not(windows))]
{
get_message("hashsum-help-binary-other")
}
})
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::CHECK)
.short('c')
.long("check")
.help("read hashsums from the FILEs and check them")
.help(get_message("hashsum-help-check"))
.action(ArgAction::SetTrue)
.conflicts_with("tag"),
)
.arg(
Arg::new(options::TAG)
.long("tag")
.help("create a BSD-style checksum")
.help(get_message("hashsum-help-tag"))
.action(ArgAction::SetTrue)
.conflicts_with("text"),
)
.arg(
Arg::new(options::TEXT)
.short('t')
.long("text")
.help(TEXT_HELP)
.help({
#[cfg(windows)]
{
get_message("hashsum-help-text-windows")
}
#[cfg(not(windows))]
{
get_message("hashsum-help-text-other")
}
})
.conflicts_with("binary")
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::QUIET)
.short('q')
.long(options::QUIET)
.help("don't print OK for each successfully verified file")
.help(get_message("hashsum-help-quiet"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::STATUS, options::WARN]),
)
.arg(
Arg::new(options::STATUS)
.short('s')
.long("status")
.help("don't output anything, status code shows success")
.help(get_message("hashsum-help-status"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::QUIET, options::WARN]),
)
.arg(
Arg::new(options::STRICT)
.long("strict")
.help("exit non-zero for improperly formatted checksum lines")
.help(get_message("hashsum-help-strict"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("ignore-missing")
.long("ignore-missing")
.help("don't fail or report status for missing files")
.help(get_message("hashsum-help-ignore-missing"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::WARN)
.short('w')
.long("warn")
.help("warn about improperly formatted checksum lines")
.help(get_message("hashsum-help-warn"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::QUIET, options::STATUS]),
)
.arg(
Arg::new("zero")
.short('z')
.long("zero")
.help("end each output line with NUL, not newline")
.help(get_message("hashsum-help-zero"))
.action(ArgAction::SetTrue),
)
.arg(
Expand All @@ -416,10 +426,7 @@ fn uu_app_opt_length(command: Command) -> Command {
.long(options::LENGTH)
.value_parser(value_parser!(usize))
.short('l')
.help(
"digest length in bits; must not exceed the max for the blake2 algorithm \
and must be a multiple of 8",
)
.help(get_message("hashsum-help-length"))
.overrides_with(options::LENGTH)
.action(ArgAction::Set),
)
Expand All @@ -433,7 +440,7 @@ fn uu_app_b3sum_opts(command: Command) -> Command {
command.arg(
Arg::new("no-names")
.long("no-names")
.help("Omits filenames in the output (option not present in GNU/Coreutils)")
.help(get_message("hashsum-help-no-names"))
.action(ArgAction::SetTrue),
)
}
Expand All @@ -447,7 +454,7 @@ fn uu_app_opt_bits(command: Command) -> Command {
command.arg(
Arg::new("bits")
.long("bits")
.help("set the size of the output (only for SHAKE)")
.help(get_message("hashsum-help-bits"))
.value_name("BITS")
// XXX: should we actually use validators? they're not particularly efficient
.value_parser(parse_bit_num),
Expand All @@ -457,34 +464,28 @@ fn uu_app_opt_bits(command: Command) -> Command {
pub fn uu_app_custom() -> Command {
let mut command = uu_app_b3sum_opts(uu_app_opt_bits(uu_app_common()));
let algorithms = &[
("md5", "work with MD5"),
("sha1", "work with SHA1"),
("sha224", "work with SHA224"),
("sha256", "work with SHA256"),
("sha384", "work with SHA384"),
("sha512", "work with SHA512"),
("sha3", "work with SHA3"),
("sha3-224", "work with SHA3-224"),
("sha3-256", "work with SHA3-256"),
("sha3-384", "work with SHA3-384"),
("sha3-512", "work with SHA3-512"),
(
"shake128",
"work with SHAKE128 using BITS for the output size",
),
(
"shake256",
"work with SHAKE256 using BITS for the output size",
),
("b2sum", "work with BLAKE2"),
("b3sum", "work with BLAKE3"),
("md5", get_message("hashsum-help-md5")),
("sha1", get_message("hashsum-help-sha1")),
("sha224", get_message("hashsum-help-sha224")),
("sha256", get_message("hashsum-help-sha256")),
("sha384", get_message("hashsum-help-sha384")),
("sha512", get_message("hashsum-help-sha512")),
("sha3", get_message("hashsum-help-sha3")),
("sha3-224", get_message("hashsum-help-sha3-224")),
("sha3-256", get_message("hashsum-help-sha3-256")),
("sha3-384", get_message("hashsum-help-sha3-384")),
("sha3-512", get_message("hashsum-help-sha3-512")),
("shake128", get_message("hashsum-help-shake128")),
("shake256", get_message("hashsum-help-shake256")),
("b2sum", get_message("hashsum-help-b2sum")),
("b3sum", get_message("hashsum-help-b3sum")),
];

for (name, desc) in algorithms {
command = command.arg(
Arg::new(*name)
.long(name)
.help(*desc)
.help(desc)
.action(ArgAction::SetTrue),
);
}
Expand Down Expand Up @@ -549,7 +550,7 @@ where
options.binary,
options.output_bits,
)
.map_err_context(|| "failed to read input".to_string())?;
.map_err_context(|| get_message("hashsum-error-failed-to-read-input"))?;
let (escaped_filename, prefix) = escape_filename(filename);
if options.tag {
if options.algoname == "blake2b" {
Expand Down
Loading