summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-07-11 11:11:37 +0200
committerRobin Jarry <robin@jarry.cc>2022-07-17 19:00:44 +0200
commitdb00accb574190d1d33d7c57e2677781a015b301 (patch)
tree5e6374ae480460426ecfc1923b9eb0d17fad4c1c
parentf2dac06029a273aa8d5bcfc24102e113b29138be (diff)
downloadaerc-db00accb574190d1d33d7c57e2677781a015b301.zip
config: allow per-account address-book-cmd
When using multiple accounts, the contacts may be different. Allow using specific address book commands per account. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
-rw-r--r--config/aerc.conf2
-rw-r--r--config/config.go3
-rw-r--r--doc/aerc-config.5.scd2
-rw-r--r--widgets/compose.go6
4 files changed, 12 insertions, 1 deletions
diff --git a/config/aerc.conf b/config/aerc.conf
index 2906381..6c89f85 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -263,6 +263,8 @@ header-layout=To|From,Subject
# the first field. Only the email address field is required. The second field,
# if present, will be treated as the contact name. Additional fields are
# ignored.
+#
+# This parameter can also be set per account in accounts.conf.
address-book-cmd=
#
diff --git a/config/config.go b/config/config.go
index e0c8608..ebdee5e 100644
--- a/config/config.go
+++ b/config/config.go
@@ -112,6 +112,7 @@ type AccountConfig struct {
SignatureCmd string
EnableFoldersSort bool `ini:"enable-folders-sort"`
FoldersSort []string `ini:"folders-sort" delim:","`
+ AddressBookCmd string `ini:"address-book-cmd"`
// CheckMail
CheckMail time.Duration `ini:"check-mail"`
@@ -279,6 +280,8 @@ func loadAccountConfig(path string) ([]AccountConfig, error) {
account.PgpAutoSign, _ = strconv.ParseBool(val)
} else if key == "pgp-opportunistic-encrypt" {
account.PgpOpportunisticEncrypt, _ = strconv.ParseBool(val)
+ } else if key == "address-book-cmd" {
+ account.AddressBookCmd = val
} else if key != "name" {
account.Params[key] = val
}
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index 55bc7a8..2338b26 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -467,6 +467,8 @@ These options are configured in the *[compose]* section of aerc.conf.
if present, will be treated as the contact name. Additional fields are
ignored.
+ This parameter can also be set per account in accounts.conf.
+
Example:
khard email --remove-first-line --parsable '%s'
diff --git a/widgets/compose.go b/widgets/compose.go
index 465a733..87331bd 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -82,7 +82,11 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
}
templateData := templates.ParseTemplateData(h, orig)
- cmpl := completer.New(conf.Compose.AddressBookCmd, func(err error) {
+ cmd := acctConfig.AddressBookCmd
+ if cmd == "" {
+ cmd = conf.Compose.AddressBookCmd
+ }
+ cmpl := completer.New(cmd, func(err error) {
aerc.PushError(
fmt.Sprintf("could not complete header: %v", err))
worker.Logger.Printf("could not complete header: %v", err)