diff options
author | Daniel <quite@hack.org> | 2012-02-24 14:22:27 +0100 |
---|---|---|
committer | Daniel <quite@hack.org> | 2012-02-24 14:22:27 +0100 |
commit | 72e7466649fdc830668e236e5f5162c7fbdb4aec (patch) | |
tree | 7fc44e6335ad23ed82aecd1aca6af444870c8999 /alot/account.py | |
parent | cd7f84dea631529920e46dd6eafa4423e7f7090f (diff) |
Made default abook_regexp to better comply with the format
The default regexp now ignores a third field (only caring for the
first email and name). Tabs are not transformed to spaces before
matching is done. "goobook query" now works with the default regexp
like it should; both it and abook were made to output a mutt
query_command compatible format. Docs are updated accordingly. The
example for nottoomuch-addresses still works.
Diffstat (limited to 'alot/account.py')
-rw-r--r-- | alot/account.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alot/account.py b/alot/account.py index d15e7f2a..c41266ad 100644 --- a/alot/account.py +++ b/alot/account.py @@ -249,12 +249,12 @@ class MatchSdtoutAddressbook(AddressBook): :param match: regular expression used to match contacts in `commands` output to stdout. Must define subparts named "email" and "name". Defaults to - :regexp:`(?P<email>.+?@.+?)\s+(?P<name>.+?)\s*$`. + :regexp:`^(?P<email>[^@]+@[^\t]+)\t+(?P<name>[^\t]+)`. :type match: str """ self.command = command if not match: - self.match = '(?P<email>.+?@.+?)\s+(?P<name>.+?)\s*$' + self.match = '^(?P<email>[^@]+@[^\t]+)\t+(?P<name>[^\t]+)' else: self.match = match @@ -266,7 +266,7 @@ class MatchSdtoutAddressbook(AddressBook): resultstring, errmsg, retval = helper.call_cmd(cmdlist + [prefix]) if not resultstring: return [] - lines = resultstring.replace('\t', ' ' * 4).splitlines() + lines = resultstring.splitlines() res = [] for l in lines: m = re.match(self.match, l) |