feat: add count outputs
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user