feat: add count outputs
This commit is contained in:
16
src/main.rs
16
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") {
|
if let Some(members) = matches.values_of("member") {
|
||||||
let members = members.collect::<HashSet<&str>>();
|
let members = members.collect::<HashSet<&str>>();
|
||||||
tokens = tokens.into_iter()
|
tokens = tokens.into_iter()
|
||||||
@@ -113,10 +115,18 @@ fn main() -> std::io::Result<()> {
|
|||||||
tokens = tokens.into_iter().take(head_count).collect::<Vec<Token>>();
|
tokens = tokens.into_iter().take(head_count).collect::<Vec<Token>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.is_present("inline") {
|
if tokens.is_empty() {
|
||||||
tokens.iter().for_each(|i| i.inline());
|
println!("{}", "Cool, cannot find any TODO in this project".green().bold())
|
||||||
} else {
|
} else {
|
||||||
tokens.iter().for_each(|i| println!("{}", i));
|
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(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user