mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 09:27:21 +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() {
|
||||
if verbose {
|
||||
let pass_name = pass_name(&pass_type);
|
||||
if total_passes < 10 {
|
||||
show_error!(
|
||||
"{}: pass {}/{} ({})...",
|
||||
path.maybe_quote(),
|
||||
i + 1,
|
||||
total_passes,
|
||||
pass_name
|
||||
);
|
||||
} else {
|
||||
show_error!(
|
||||
"{}: pass {:2.0}/{:2.0} ({})...",
|
||||
path.maybe_quote(),
|
||||
i + 1,
|
||||
total_passes,
|
||||
pass_name
|
||||
);
|
||||
}
|
||||
show_error!(
|
||||
"{}: pass {:2}/{} ({})...",
|
||||
path.maybe_quote(),
|
||||
i + 1,
|
||||
total_passes,
|
||||
pass_name
|
||||
);
|
||||
}
|
||||
// size is an optional argument for exactly how many bytes we want to shred
|
||||
// Ignore failed writes; just keep trying
|
||||
|
|
Loading…
Reference in a new issue