Skip to content

Commit

Permalink
Fix for #684 (#686)
Browse files Browse the repository at this point in the history
* Fix for #684

Bascially the implementation as per this instruction:

#685 (comment)

* refactor
  • Loading branch information
Byron committed Dec 29, 2020
1 parent f938223 commit a64cfcc
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/cli_utils.rs
Expand Up @@ -191,6 +191,28 @@ impl<W: Write> Printer<W> {
)
}

fn print_language_in_print_total(&mut self, language: &Language) -> io::Result<()>
where
W: Write,
{
self.print_language_name(language.inaccurate, "Total", None)?;
write!(self.writer, " ")?;
writeln!(
self.writer,
"{:>6} {:>12} {:>12} {:>12} {:>12}",
language
.children
.values()
.map(Vec::len)
.sum::<usize>()
.to_formatted_string(&self.number_format),
language.lines().to_formatted_string(&self.number_format),
language.code.to_formatted_string(&self.number_format),
language.comments.to_formatted_string(&self.number_format),
language.blanks.to_formatted_string(&self.number_format),
)
}

pub fn print_language_name(
&mut self,
inaccurate: bool,
Expand Down Expand Up @@ -431,7 +453,7 @@ impl<W: Write> Printer<W> {
pub fn print_total(&mut self, languages: tokei::Languages) -> io::Result<()> {
let total = languages.total();
self.print_row()?;
self.print_language(&total, "Total")?;
self.print_language_in_print_total(&total)?;
self.print_row()
}
}

0 comments on commit a64cfcc

Please sign in to comment.