diff options
author | Moritz Poldrack <git@moritz.sh> | 2023-03-15 22:40:38 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-04-01 01:01:09 +0200 |
commit | f10b184eb34634b9642fa83ef0f1cd8d0687a4af (patch) | |
tree | 8806be0073294a1d6542fa0447d8fee8e12230e5 /lib | |
parent | 2fef0f4a60c8026c156ad8d75078bccde6a540d8 (diff) | |
download | aerc-f10b184eb34634b9642fa83ef0f1cd8d0687a4af.tar.gz |
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 <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hooks/aerc-startup.go | 23 |
1 files changed, 23 insertions, 0 deletions
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]), + } +} |