From f10b184eb34634b9642fa83ef0f1cd8d0687a4af Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Wed, 15 Mar 2023 22:40:38 +0100 Subject: hooks: add aerc-startup hook Add a hook to run when aerc starts up. The environment is supplemented with aerc version and the path to its binary. References: https://todo.sr.ht/~rjarry/aerc/136 References: https://todo.sr.ht/~rjarry/aerc/139 Signed-off-by: Moritz Poldrack Signed-off-by: Robin Jarry Tested-by: Bence Ferdinandy --- lib/hooks/aerc-startup.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/hooks/aerc-startup.go (limited to 'lib') diff --git a/lib/hooks/aerc-startup.go b/lib/hooks/aerc-startup.go new file mode 100644 index 00000000..a53d070e --- /dev/null +++ b/lib/hooks/aerc-startup.go @@ -0,0 +1,23 @@ +package hooks + +import ( + "fmt" + "os" + + "git.sr.ht/~rjarry/aerc/config" +) + +type AercStartup struct { + Version string +} + +func (m *AercStartup) Cmd() string { + return config.Hooks.AercStartup +} + +func (m *AercStartup) Env() []string { + return []string{ + fmt.Sprintf("AERC_VERSION=%s", m.Version), + fmt.Sprintf("AERC_BINARY=%s", os.Args[0]), + } +} -- cgit