Add contributing info
Print usage without logging info (e.g. timestamp)
Don't fail when command exits with non-zero status
jasoncarloscox.com/creations/addr-book-combine
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:
a@example.com Andy Apple 5
b@example.com Bart Berry 2
c@example.com Chad Cherry 4
d@example.com
(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
go test
Contributions are welcome! You can send questions, bug reports, patches, etc. by email to ~jcc/public-inbox@lists.sr.ht. (Don't know how to contribute via email? Check out the interactive tutorial at git-send-email.io, or email me for help.)