summaryrefslogtreecommitdiff
path: root/clab
diff options
context:
space:
mode:
Diffstat (limited to 'clab')
-rwxr-xr-xclab10
1 files changed, 8 insertions, 2 deletions
diff --git a/clab b/clab
index d47700a..33307a7 100755
--- a/clab
+++ b/clab
@@ -147,12 +147,18 @@ class CommandLineAddressBook(cliapp.Application):
self.output.write('No matches\n')
sys.exit(1)
self.output.write('clab found matches:\n')
+
+ name_addr_pairs = set()
for entry in entries:
name = entry.get_single('name', '')
emails = entry.get_subdict('email')
for email in emails:
- n = name.encode('utf-8')
- self.output.write('%s\t%s\n' % (emails[email], n))
+ name_addr_pairs.add((name, emails[email]))
+
+ for name, addr in sorted(name_addr_pairs):
+ n = name.encode('utf-8')
+ a = addr.encode('utf-8')
+ self.output.write('%s\t%s\n' % (a, n))
CommandLineAddressBook().run()