summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 08fc655..b8645d5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -176,9 +176,16 @@ struct MuttCommand {
impl MuttCommand {
fn run(&self, _opt: &Opt, book: &AddressBook) {
- for e in book.iter().filter(|e| self.is_match(e)) {
+ let matches: Vec<Entry> = book.iter().filter(|e| self.is_match(e)).cloned().collect();
+ if matches.is_empty() {
+ println!("clab found no matches");
+ std::process::exit(1);
+ }
+
+ println!("clab found matches:");
+ for e in matches {
for email in e.emails() {
- println!("{}\t{}", e.name, email);
+ println!("{}\t{}", email, e.name);
}
}
}