mirror of
https://github.com/XAMPPRocky/tokei
synced 2024-08-28 03:39:37 +00:00
* Fix for #684 Bascially the implementation as per this instruction: https://github.com/XAMPPRocky/tokei/pull/685#issuecomment-752112937 * refactor
This commit is contained in:
parent
f938223a1a
commit
a64cfcc699
|
@ -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(
|
pub fn print_language_name(
|
||||||
&mut self,
|
&mut self,
|
||||||
inaccurate: bool,
|
inaccurate: bool,
|
||||||
|
@ -431,7 +453,7 @@ impl<W: Write> Printer<W> {
|
||||||
pub fn print_total(&mut self, languages: tokei::Languages) -> io::Result<()> {
|
pub fn print_total(&mut self, languages: tokei::Languages) -> io::Result<()> {
|
||||||
let total = languages.total();
|
let total = languages.total();
|
||||||
self.print_row()?;
|
self.print_row()?;
|
||||||
self.print_language(&total, "Total")?;
|
self.print_language_in_print_total(&total)?;
|
||||||
self.print_row()
|
self.print_row()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue