1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Merge pull request #2259 from jfinkels/wc-compute-each-file-and-print

wc: print counts for each file as soon as computed
This commit is contained in:
Terts Diepraam 2021-05-24 17:55:10 +02:00 committed by GitHub
commit da085eca98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -373,7 +373,6 @@ fn wc(inputs: Vec<Input>, settings: &Settings) -> Result<(), u32> {
let max_width = max_width(&inputs); let max_width = max_width(&inputs);
let mut total_word_count = WordCount::default(); let mut total_word_count = WordCount::default();
let mut results = vec![];
let num_inputs = inputs.len(); let num_inputs = inputs.len();
@ -384,10 +383,7 @@ fn wc(inputs: Vec<Input>, settings: &Settings) -> Result<(), u32> {
WordCount::default() WordCount::default()
}); });
total_word_count += word_count; total_word_count += word_count;
results.push(word_count.with_title(input.to_title())); let result = word_count.with_title(input.to_title());
}
for result in &results {
if let Err(err) = print_stats(settings, &result, max_width) { if let Err(err) = print_stats(settings, &result, max_width) {
show_warning!( show_warning!(
"failed to print result for {}: {}", "failed to print result for {}: {}",