Compare commits

..

No commits in common. "main" and "ef1fdb5f369856fd901bf18aae81fa774f37dabe" have entirely different histories.

1 changed files with 34 additions and 30 deletions

View File

@ -89,33 +89,32 @@ fn run(
let statuses = client.statuses(&acc.id, None)?;
let regex = Regex::new(regex).unwrap();
let mut count = 0;
let mut results = Vec::new();
println!("\n\nResults:\n");
if verbose {
println!("Searching...");
}
// Search through statuses
for status in statuses.items_iter() {
// Add it to results if it matches and it isn't a retoot
// or if it matches and isn't a retoot
if status_matches(&status, &regex) && (include_retoots || status.reblog.is_none()) {
print_status(&status, verbose);
count += 1;
results.push(status);
}
// If there's a limit of results, check it and exit
if let Some(max) = max_statuses {
if count >= max {
if results.len() >= max {
break;
}
}
}
println!("Found {} results", count);
println!("\n\nResults:\n");
Ok(())
}
fn print_status(status: &Status, verbose: bool) {
// Print results
for status in &results {
if !status.spoiler_text.is_empty() {
println!("CW: {}", status.spoiler_text);
}
@ -142,6 +141,11 @@ fn print_status(status: &Status, verbose: bool) {
}
println!();
}
println!("Found {} results", results.len());
Ok(())
}
fn status_matches(status: &Status, regex: &Regex) -> bool {