aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2024-08-11 16:03:07 -0500
committerRobin Jarry <robin@jarry.cc>2024-08-20 09:29:33 +0200
commitda5ca1a53043b6b3d8c5bfc7f6eff340985e3edb (patch)
tree1c32ed6bd61bfa0861b7687cfbad5ff42f5b1ad9 /lib
parente35c193db12fe4814b7144f2f37e5a7dd5715826 (diff)
downloadaerc-da5ca1a53043b6b3d8c5bfc7f6eff340985e3edb.tar.gz
template: pass account and folder names to signature command
This can help to dynamically determine what signature you want. Changelog-added: `AERC_ACCOUNT` and `AERC_FOLDER` are now available in the signature command environment. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/state/templates.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/state/templates.go b/lib/state/templates.go
index 801de752..c7bfad8c 100644
--- a/lib/state/templates.go
+++ b/lib/state/templates.go
@@ -713,6 +713,10 @@ func (d *templateData) Signature() string {
func (d *templateData) readSignatureFromCmd() ([]byte, error) {
sigCmd := d.account.SignatureCmd
cmd := exec.Command("sh", "-c", sigCmd)
+ env := os.Environ()
+ env = append(env, fmt.Sprintf("AERC_ACCOUNT=%s", d.account.Name))
+ env = append(env, fmt.Sprintf("AERC_FOLDER=%s", d.folder.Name))
+ cmd.Env = env
signature, err := cmd.Output()
if err != nil {
return nil, err