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

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>
23 lines
344 B
Go
23 lines
344 B
Go
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]),
|
|
}
|
|
}
|