diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-04-26 22:18:53 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-04-26 22:28:44 +0200 |
| commit | a0d42ec0f4f57ccb0a68cae2bf8d4fa8e26aa962 (patch) | |
| tree | db5d7f7a839b05b7d3957200c342e9835a4b2044 | |
| parent | 7d9be5450a0a8682f7d338d939fb257dd61e27dd (diff) | |
| download | mail-a0d42ec0f4f57ccb0a68cae2bf8d4fa8e26aa962.tar.gz | |
take list of threads instead
| -rw-r--r-- | src/main.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 2f1f5cc..e4d4a4b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use std::io::{Write, stdin, stdout}; +use notmuch::Thread; use termion::color; use termion::event::Key; use termion::input::TermRead; @@ -17,12 +18,7 @@ fn main() { // get threads let query = db.create_query("tag:inbox").unwrap(); - let threads = query.search_threads().unwrap(); - let threads = threads - .map(|t| format!("thread {:?}, {:?}", - t.subject(), - t.authors())) - .collect(); + let threads = query.search_threads().unwrap().collect(); let mut i: isize = 0; show_threads(&mut screen, &threads, i as usize); @@ -39,7 +35,7 @@ fn main() { } } -fn show_threads<W: Write>(stdout: &mut W, threads: &Vec<String>, highlight: usize) { +fn show_threads<W: Write>(stdout: &mut W, threads: &Vec<Thread>, highlight: usize) { write!(stdout, "{}", termion::clear::All).unwrap(); for (i, thread) in threads.iter().enumerate() { @@ -48,7 +44,7 @@ fn show_threads<W: Write>(stdout: &mut W, threads: &Vec<String>, highlight: usiz if highlight { write!(stdout, "{}", color::Fg(color::Red)).unwrap(); } - write!(stdout, "{}", thread).unwrap(); + write!(stdout, "thread {:?}, {:?}", thread.subject(), thread.authors()).unwrap(); if highlight { write!(stdout, "{}", color::Fg(color::Reset)).unwrap(); } |
