Add contributing info
Print usage without logging info (e.g. timestamp)
Don't fail when command exits with non-zero status
Combine multiple aerc-style address books into a single address book, with de-duplication and smart sorting.
Works well with maildir-rank-addr.
addr-book-combine (-f <file> | -c <command>) ...
<file>is the path to a file containing address book entries.
<command>is a command (to be run with
sh -c) that outputs address book entries on stdout.
Each argument (
-f <file> or
-c <command>) is considered a separate address book. Each book contains entries, each on their own line. Entries have tab-separated fields (
address<tab>name<tab>rank). Here's an example address book:
email@example.com Andy Apple 5 firstname.lastname@example.org Bart Berry 2 email@example.com Chad Cherry 4 firstname.lastname@example.org
(Names and ranks are optional.)
When comparing two addresses, a and b, which appear in books numbered i and j, respectively, the following procedure is applied:
First, if the addresses are not from the same book, the address from the earlier book appears first.
Next, each book is checked to compare the addresses:
Finally, if no address has been chosen to appear first, preserve the original order of the addresses.
Check out the test code to see some examples.
go build ./addr-book-combine
Contributions are welcome! You can send questions, bug reports, patches, etc. by email to ~email@example.com. (Don't know how to contribute via email? Check out the interactive tutorial at git-send-email.io, or email me for help.)