feat: add count outputs

This commit is contained in:
2020-08-02 01:37:01 +08:00
parent 6e114512ae
commit 258ded8e78

View File

@@ -82,6 +82,8 @@ fn main() -> std::io::Result<()> {
}
}
let total_count = tokens.len();
if let Some(members) = matches.values_of("member") {
let members = members.collect::<HashSet<&str>>();
tokens = tokens.into_iter()
@@ -113,11 +115,19 @@ fn main() -> std::io::Result<()> {
tokens = tokens.into_iter().take(head_count).collect::<Vec<Token>>();
}
if tokens.is_empty() {
println!("{}", "Cool, cannot find any TODO in this project".green().bold())
} else {
if matches.is_present("inline") {
tokens.iter().for_each(|i| i.inline());
} else {
tokens.iter().for_each(|i| println!("{}", i));
}
println!("Found total {} TODOs, {} displayed",
format!(" {} ", total_count.to_string()).bold().underline(),
format!(" {} ", tokens.len().to_string()).bold().green().underline(),
);
}
Ok(())
}