mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
fixup! wc: rm leading space when printing multiple counts
This commit is contained in:
parent
525f71bada
commit
ee43655bdb
1 changed files with 19 additions and 28 deletions
|
@ -372,51 +372,42 @@ fn print_stats(
|
|||
let mut is_first: bool = true;
|
||||
|
||||
if settings.show_lines {
|
||||
if is_first {
|
||||
write!(stdout_lock, "{:1$}", result.count.lines, min_width)?;
|
||||
} else {
|
||||
write!(stdout_lock, " {:1$}", result.count.lines, min_width)?;
|
||||
if !is_first {
|
||||
write!(stdout_lock, " ")?;
|
||||
}
|
||||
write!(stdout_lock, "{:1$}", result.count.lines, min_width)?;
|
||||
is_first = false;
|
||||
}
|
||||
if settings.show_words {
|
||||
if is_first {
|
||||
write!(stdout_lock, "{:1$}", result.count.words, min_width)?;
|
||||
} else {
|
||||
write!(stdout_lock, " {:1$}", result.count.words, min_width)?;
|
||||
if !is_first {
|
||||
write!(stdout_lock, " ")?;
|
||||
}
|
||||
write!(stdout_lock, "{:1$}", result.count.words, min_width)?;
|
||||
is_first = false;
|
||||
}
|
||||
if settings.show_bytes {
|
||||
if is_first {
|
||||
write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?;
|
||||
} else {
|
||||
write!(stdout_lock, " {:1$}", result.count.bytes, min_width)?;
|
||||
if !is_first {
|
||||
write!(stdout_lock, " ")?;
|
||||
}
|
||||
write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?;
|
||||
is_first = false;
|
||||
}
|
||||
if settings.show_chars {
|
||||
if is_first {
|
||||
write!(stdout_lock, "{:1$}", result.count.chars, min_width)?;
|
||||
} else {
|
||||
write!(stdout_lock, " {:1$}", result.count.chars, min_width)?;
|
||||
if !is_first {
|
||||
write!(stdout_lock, " ")?;
|
||||
}
|
||||
write!(stdout_lock, "{:1$}", result.count.chars, min_width)?;
|
||||
is_first = false;
|
||||
}
|
||||
if settings.show_max_line_length {
|
||||
if is_first {
|
||||
write!(
|
||||
stdout_lock,
|
||||
"{:1$}",
|
||||
result.count.max_line_length, min_width
|
||||
)?;
|
||||
} else {
|
||||
write!(
|
||||
stdout_lock,
|
||||
" {:1$}",
|
||||
result.count.max_line_length, min_width
|
||||
)?;
|
||||
if !is_first {
|
||||
write!(stdout_lock, " ")?;
|
||||
}
|
||||
write!(
|
||||
stdout_lock,
|
||||
"{:1$}",
|
||||
result.count.max_line_length, min_width
|
||||
)?;
|
||||
}
|
||||
|
||||
if result.title == "-" {
|
||||
|
|
Loading…
Reference in a new issue