-
Notifications
You must be signed in to change notification settings - Fork 96
External contacts search
Pablo Ovelleiro Corral edited this page Aug 18, 2015
·
2 revisions
When in a recipient field, the tab
key will autocomplete the current input with relevant email or names. This data can come from emails that are already stored and parsed in sup, but it can also come from outside programs through the extra-contact-addresses
hook. This hook takes nothing in input and gives back all known addresses for further completion by sup.
Here's an example hook with goobook, a tool to access your google account contacts:
`goobook query ''`.split("\n").map do |line|
matches = line.match(/^(?<email>[^\s]+)\t(?<name>[^\t]+)\t.*$/)
"#{matches[:name]} <#{matches[:email]}>" if matches
end.compact
out = []
`abook --mutt-query ''`.each_line do |l|
line = ''
l.chomp.split.each do |w|
line << w.chomp
line << ' '
end
out << line.strip unless line.strip.empty?
end
out