mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
shred: simplify the code
The formatting directive {:2.0} will handle both cases (single-digit and double-digit numbers) by ensuring at least two characters wide with no decimal places
This commit is contained in:
parent
88ff42e840
commit
322c2b4df6
1 changed files with 7 additions and 17 deletions
|
@ -477,23 +477,13 @@ fn wipe_file(
|
||||||
for (i, pass_type) in pass_sequence.into_iter().enumerate() {
|
for (i, pass_type) in pass_sequence.into_iter().enumerate() {
|
||||||
if verbose {
|
if verbose {
|
||||||
let pass_name = pass_name(&pass_type);
|
let pass_name = pass_name(&pass_type);
|
||||||
if total_passes < 10 {
|
show_error!(
|
||||||
show_error!(
|
"{}: pass {:2}/{} ({})...",
|
||||||
"{}: pass {}/{} ({})...",
|
path.maybe_quote(),
|
||||||
path.maybe_quote(),
|
i + 1,
|
||||||
i + 1,
|
total_passes,
|
||||||
total_passes,
|
pass_name
|
||||||
pass_name
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
show_error!(
|
|
||||||
"{}: pass {:2.0}/{:2.0} ({})...",
|
|
||||||
path.maybe_quote(),
|
|
||||||
i + 1,
|
|
||||||
total_passes,
|
|
||||||
pass_name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// size is an optional argument for exactly how many bytes we want to shred
|
// size is an optional argument for exactly how many bytes we want to shred
|
||||||
// Ignore failed writes; just keep trying
|
// Ignore failed writes; just keep trying
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue