diff options
author | Moritz Poldrack <git@moritz.sh> | 2023-03-15 22:40:39 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-04-01 01:01:09 +0200 |
commit | b46b2d22824a4feb351f27fff8dce3d6947b190b (patch) | |
tree | 1783a28419b533d0b43aa73073176fa321b7ed0a /lib | |
parent | f10b184eb34634b9642fa83ef0f1cd8d0687a4af (diff) | |
download | aerc-b46b2d22824a4feb351f27fff8dce3d6947b190b.tar.gz |
hooks: add aerc-shutdown
Add a hook to run when aerc shuts down. The environment is supplemented
with the duration aerc was alive for.
References: https://todo.sr.ht/~rjarry/aerc/136
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-shutdown.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/hooks/aerc-shutdown.go b/lib/hooks/aerc-shutdown.go new file mode 100644 index 00000000..a3f55f73 --- /dev/null +++ b/lib/hooks/aerc-shutdown.go @@ -0,0 +1,22 @@ +package hooks + +import ( + "fmt" + "time" + + "git.sr.ht/~rjarry/aerc/config" +) + +type AercShutdown struct { + Lifetime time.Duration +} + +func (a *AercShutdown) Cmd() string { + return config.Hooks.AercShutdown +} + +func (a *AercShutdown) Env() []string { + return []string{ + fmt.Sprintf("AERC_LIFETIME=%s", a.Lifetime.String()), + } +} |