henrycatalinismith / ppl

The command line address book
http://henry.catalinismith.com/ppl/
Other
300 stars 18 forks source link

Mutt queries and multiple emails #20

Closed pigmonkey closed 11 years ago

pigmonkey commented 11 years ago

Let's say I have a contact joe with multiple emails.

$ ppl show joe
Joe Schmoe <joe@somewhere.com>

Email Addresses:
    joe@somewhere.com
    joe@elsewhere.com

The Mutt query only returns the contact's first email.

$ ppl mutt joe
Searching address book... 12 entries... 1 matching:
joe@somewhere.com        Joe Schmoe

I need the query to return one entry per email so that I can select which address to use in Mutt. Such as:

$ ppl mutt joe
Searching address book... 12 entries... 2 matching:
joe@somewhere.com        Joe Schmoe
joe@elsewhere.com        Joe Schmoe
henrycatalinismith commented 11 years ago

Ah, I see. I'll sort this out ASAP. Thanks for letting me know!

pigmonkey commented 11 years ago

This now works fine in 1.16.0.

The only issue is that the first line still returns the total number of contacts and the total number of matching contacts. This doesn't impact the functionality, but may be confusing for some users.

$ ppl mutt joe
Searching address book... 12 entries... 1 matching:
joe@somewhere.com        Joe Schmoe
joe@elsewhere.com        Joe Schmoe

There is 1 matching contact, but ppl is returning emails, not contacts, so there are 2 matching values. I may have only 12 contacts, but I have more than 12 total emails for those contacts.

I think it makes the most sense for ppl to report something like:

Searching address book...18 emails... 2 matching:

Or the total number of contacts could still be reported:

Searching address book... 12 entries...18 emails... 2 matching:
henrycatalinismith commented 11 years ago

Agreed. To be completely honest, I simply didn't stop and think about that "one line message" when I was implementing this.

I like your first suggestion the most. It gets rid of that vague word "entries" (which I copied from the documentation without much thought), and it's clear what both numbers are about. Plus when you're using this functionality to find email addresses, what you're probably interested in are the sets of email addresses and matching email addresses. Let's run with that. Unless any bugs come up in the meantime, this will be 1.16.1.

pigmonkey commented 11 years ago

I feel like I'm causing a lot of version bumps!

henrycatalinismith commented 11 years ago

It's very welcome, man. I'm a big fan of "sweating the little things" when it comes to little details like that "Searching address book" message above. And the feature requests are good stuff too. For a project as esoteric as ppl, it's actually just nice to know that people are even trying it.