alot: support contact completion

Make choice of contact completion easier.
This commit is contained in:
Matthieu Coudron 2019-02-05 15:03:04 +09:00 committed by Robert Helgesson
parent 74811679b7
commit 81dae2f88e
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 33 additions and 2 deletions

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
with lib; with lib;
@ -379,7 +379,7 @@ in
accounts = mkOption { accounts = mkOption {
type = types.attrsOf (types.submodule [ type = types.attrsOf (types.submodule [
mailAccountOpts mailAccountOpts
(import ../programs/alot-accounts.nix) (import ../programs/alot-accounts.nix pkgs)
(import ../programs/astroid-accounts.nix) (import ../programs/astroid-accounts.nix)
(import ../programs/mbsync-accounts.nix) (import ../programs/mbsync-accounts.nix)
(import ../programs/msmtp-accounts.nix) (import ../programs/msmtp-accounts.nix)

View file

@ -1,3 +1,4 @@
pkgs:
{ config, lib, ... }: { config, lib, ... }:
with lib; with lib;
@ -13,6 +14,34 @@ with lib;
''; '';
}; };
contactCompletion = mkOption {
type = types.attrsOf types.str;
default = {
type = "shellcommand";
command = "'${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'";
regexp =
"'\[?{"
+ ''"name": "(?P<name>.*)", ''
+ ''"address": "(?P<email>.+)", ''
+ ''"name-addr": ".*"''
+ "}[,\]]?'";
shellcommand_external_filtering = "False";
};
example = literalExample ''
{
type = "shellcommand";
command = "abook --mutt-query";
regexp = "'^(?P<email>[^@]+@[^\t]+)\t+(?P<name>[^\t]+)'";
ignorecase = "True";
}
'';
description = ''
Contact completion configuration as expected per alot.
See <link xlink:href="http://alot.readthedocs.io/en/latest/configuration/contacts_completion.html">alot's wiki</link> for
explanation about possible values.
'';
};
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";

View file

@ -33,6 +33,8 @@ let
boolStr (signature.showSignature == "attach"); boolStr (signature.showSignature == "attach");
} }
) )
++ [ "[[[abook]]]" ]
++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion
) )
+ "\n" + "\n"
+ alot.extraConfig; + alot.extraConfig;