From 51fa75397dda2c280f29760e7b525caefc03642e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 19 Mar 2021 16:13:03 +0100 Subject: initial notmuch Prints all unread+inbox from a hard-coded notmuch database. --- src/main.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 7c12a7c..1b30c67 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,9 @@ -use std::io::{Write, stdout}; -use crossterm::{cursor, execute, terminal}; - fn main() { - let mut stdout = stdout(); + let db = notmuch::Database::open(&"/home/gustav/.mail", notmuch::DatabaseMode::ReadOnly).unwrap(); + let query = db.create_query("tag:inbox and tag:unread").unwrap(); + let threads = query.search_threads().unwrap(); - execute!(stdout, terminal::Clear(terminal::ClearType::All)).unwrap(); - execute!(stdout, cursor::MoveTo(5, 5)).unwrap(); - write!(stdout, "wowee").unwrap(); - execute!(stdout, cursor::MoveTo(5, 7)).unwrap(); - write!(stdout, "eewow").unwrap(); - execute!(stdout, cursor::MoveTo(5, 7)).unwrap(); - write!(stdout, "WOWEE").unwrap(); + for thread in threads { + println!("thread {:?}, {:?}", thread.subject(), thread.authors()); + } } -- cgit v1.2.1