Skip to content

Commit 2b67abe

Browse files
authored
hashsum: Drop --no-names (#9762)
Co-authored-by: oech3 <>
1 parent aacbeb5 commit 2b67abe

File tree

6 files changed

+3
-46
lines changed

6 files changed

+3
-46
lines changed

src/uu/cksum/src/cksum.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
216216
algo_kind: algo,
217217
output_format,
218218
line_ending,
219-
no_names: false,
220219
};
221220

222221
perform_checksum_computation(opts, files)?;

src/uu/hashsum/locales/en-US.ftl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ hashsum-help-ignore-missing = don't fail or report status for missing files
1818
hashsum-help-warn = warn about improperly formatted checksum lines
1919
hashsum-help-zero = end each output line with NUL, not newline
2020
hashsum-help-length = digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8
21-
hashsum-help-no-names = Omits filenames in the output (option not present in GNU/Coreutils)
2221
hashsum-help-bits = set the size of the output (only for SHAKE)
2322
2423
# Algorithm help messages

src/uu/hashsum/locales/fr-FR.ftl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ hashsum-help-ignore-missing = ne pas échouer ou rapporter le statut pour les fi
1515
hashsum-help-warn = avertir des lignes de somme de contrôle mal formatées
1616
hashsum-help-zero = terminer chaque ligne de sortie avec NUL, pas de retour à la ligne
1717
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
18-
hashsum-help-no-names = Omet les noms de fichiers dans la sortie (option non présente dans GNU/Coreutils)
1918
hashsum-help-bits = définir la taille de la sortie (uniquement pour SHAKE)
2019
2120
# Messages d'aide des algorithmes

src/uu/hashsum/src/hashsum.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
// spell-checker:ignore (ToDO) algo, algoname, bitlen, regexes, nread, nonames
6+
// spell-checker:ignore (ToDO) algo, algoname, bitlen, regexes, nread
77

88
use std::ffi::{OsStr, OsString};
99
use std::iter;
@@ -211,10 +211,6 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
211211
return Err(ChecksumError::StrictNotCheck.into());
212212
}
213213

214-
let no_names = *matches
215-
.try_get_one("no-names")
216-
.unwrap_or(None)
217-
.unwrap_or(&false);
218214
let line_ending = LineEnding::from_zero_flag(matches.get_flag("zero"));
219215

220216
let algo = SizedAlgoKind::from_unsized(algo_kind, length)?;
@@ -229,7 +225,6 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
229225
/* base64: */ false,
230226
),
231227
line_ending,
232-
no_names,
233228
};
234229

235230
let files = matches.get_many::<OsString>(options::FILE).map_or_else(
@@ -384,19 +379,6 @@ fn uu_app_opt_length(command: Command) -> Command {
384379
)
385380
}
386381

387-
pub fn uu_app_b3sum() -> Command {
388-
uu_app_b3sum_opts(uu_app_common())
389-
}
390-
391-
fn uu_app_b3sum_opts(command: Command) -> Command {
392-
command.arg(
393-
Arg::new("no-names")
394-
.long("no-names")
395-
.help(translate!("hashsum-help-no-names"))
396-
.action(ArgAction::SetTrue),
397-
)
398-
}
399-
400382
pub fn uu_app_bits() -> Command {
401383
uu_app_opt_bits(uu_app_common())
402384
}
@@ -414,7 +396,7 @@ fn uu_app_opt_bits(command: Command) -> Command {
414396
}
415397

416398
pub fn uu_app_custom() -> Command {
417-
let mut command = uu_app_b3sum_opts(uu_app_opt_bits(uu_app_common()));
399+
let mut command = uu_app_opt_bits(uu_app_common());
418400
let algorithms = &[
419401
("md5", translate!("hashsum-help-md5")),
420402
("sha1", translate!("hashsum-help-sha1")),

src/uucore/src/lib/features/checksum/compute.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ pub struct ChecksumComputeOptions {
3434

3535
/// Whether to finish lines with '\n' or '\0'.
3636
pub line_ending: LineEnding,
37-
38-
/// (non-GNU option) Do not print file names
39-
pub no_names: bool,
4037
}
4138

4239
/// Reading mode used to compute digest.
@@ -218,12 +215,6 @@ fn print_untagged_checksum(
218215
sum: &String,
219216
reading_mode: ReadingMode,
220217
) -> UResult<()> {
221-
// early check for the "no-names" option
222-
if options.no_names {
223-
print!("{sum}");
224-
return Ok(());
225-
}
226-
227218
let (escaped_filename, prefix) = if options.line_ending == LineEnding::Nul {
228219
(filename.to_string_lossy().to_string(), "")
229220
} else {

tests/by-util/test_hashsum.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rstest::rstest;
88
use uutests::new_ucmd;
99
use uutests::util::TestScenario;
1010
use uutests::util_name;
11-
// spell-checker:ignore checkfile, nonames, testf, ntestf
11+
// spell-checker:ignore checkfile, testf, ntestf
1212
macro_rules! get_hash(
1313
($str:expr) => (
1414
$str.split(' ').collect::<Vec<&str>>()[0]
@@ -41,19 +41,6 @@ macro_rules! test_digest {
4141
get_hash!(ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).pipe_in_fixture(INPUT_FILE).succeeds().no_stderr().stdout_str()));
4242
}
4343

44-
#[test]
45-
fn test_nonames() {
46-
let ts = TestScenario::new(util_name!());
47-
// EXPECTED_FILE has no newline character at the end
48-
if DIGEST_ARG == "--b3sum" {
49-
// Option only available on b3sum
50-
assert_eq!(format!("{0}\n{0}\n", ts.fixtures.read(EXPECTED_FILE)),
51-
ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).arg("--no-names").arg(INPUT_FILE).arg("-").pipe_in_fixture(INPUT_FILE)
52-
.succeeds().no_stderr().stdout_str()
53-
);
54-
}
55-
}
56-
5744
#[test]
5845
fn test_check() {
5946
let ts = TestScenario::new(util_name!());

0 commit comments

Comments
 (0)