lucc / khard

Console vcard client
https://khard.readthedocs.io/en/latest/
GNU General Public License v3.0
600 stars 65 forks source link

Add-email from fields other than From #257

Closed jeffa5 closed 4 years ago

jeffa5 commented 4 years ago

The add-email command is really useful for piping emails to and adding the contact in the From field. I think it would also be useful to be able to extract contacts from other Header fields, e.g. Cc and To.

Since these can tend to be lists it might need an interactive element to be able to skip some contacts in those lists if the user doesn't want to add them, potentially displaying a numbered list of them and letting the user select numbers they want to add?

I guess this could be added behind some new flags to the add-email command, maybe --cc and --to, or a more general -H <Header>?

lucc commented 4 years ago

We could add a --all option to iterate over all email addresses that can be found in the email message and for each ask the user if they want to import that address and look for a contact to add it to.

We could refactor the add_email_subcommand function into one function that adds emails to contacts and one that parses the email and asks the user for confirmation and then hands the email to the first function. This first function would copy most of the code from the current add_email_subcommand.

PRs welcome :)

jeffa5 commented 4 years ago

Sounds great, I'll taking a look at implementing this :)