mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-02-23 07:53:59 +01:00

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>
22 lines
324 B
Go
22 lines
324 B
Go
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()),
|
|
}
|
|
}
|