Compare commits

..

No commits in common. "4ab9416c8d7939a49cc17cf1f92f307a1774adb5" and "9fa0d7ad590e59850889b8f81f76a1c5105af6cd" have entirely different histories.

2 changed files with 8 additions and 11 deletions

View File

@ -16,9 +16,9 @@ use walkdir::WalkDir;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)] #[command(author, version, about, long_about = None)]
struct Args { struct Args {
/// Number days to search through /// Number years to search through
#[arg(short, long, default_value_t = 365)] #[arg(short, long, default_value_t = 1)]
days: i64, years: usize,
/// Enable verbose logging /// Enable verbose logging
#[arg(short, long, default_value_t = false)] #[arg(short, long, default_value_t = false)]
@ -38,8 +38,9 @@ struct Args {
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
let args = Args::parse(); let args = Args::parse();
// Just check messages from the last N days. let n = 1;
let max_age = 60 * 60 * 24 * args.days; // Just check messages from the last N years.
let max_age = 60 * 60 * 24 * 365 * n;
let start = std::time::Instant::now(); let start = std::time::Instant::now();
let unix_secs = SystemTime::now() let unix_secs = SystemTime::now()
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)

View File

@ -2,7 +2,7 @@ use std::fs::File;
use clap::Parser; use clap::Parser;
use email::fingerprint; use email::fingerprint;
use mailparse::{parse_mail, MailHeaderMap}; use mailparse::parse_mail;
use memmap::MmapOptions; use memmap::MmapOptions;
/// Use library to summarize information about given mail files /// Use library to summarize information about given mail files
@ -19,11 +19,7 @@ fn main() -> anyhow::Result<()> {
let file = File::open(&path)?; let file = File::open(&path)?;
let mmap = unsafe { MmapOptions::new().map(&file)? }; let mmap = unsafe { MmapOptions::new().map(&file)? };
let m = parse_mail(&mmap)?; let m = parse_mail(&mmap)?;
let subject = m println!("{path}\n{}", fingerprint(&m).join("\n"));
.headers
.get_first_value("subject")
.unwrap_or("(NO SUBJECT)".to_owned());
println!("{subject}: {path}\n{}", fingerprint(&m).join("\n"));
} }
Ok(()) Ok(())
} }