From 9db3710dd73b6949321a028b4dc2dc2277e97ce0 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 15 Nov 2022 22:55:55 +0100 Subject: config: move [triggers] parsing in proper file The config.go file is getting too big. Move the aerc.conf [triggers] section parsing logic into a dedicated triggers.go file. No functional change. Signed-off-by: Robin Jarry Acked-by: Moritz Poldrack --- config/config.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'config/config.go') diff --git a/config/config.go b/config/config.go index 20e28bd2..049b305f 100644 --- a/config/config.go +++ b/config/config.go @@ -15,11 +15,6 @@ import ( "git.sr.ht/~rjarry/aerc/logging" ) -type TriggersConfig struct { - NewEmail string `ini:"new-email"` - ExecuteCommand func(command []string) error -} - type AercConfig struct { Bindings BindingConfig ContextualBinds []BindingConfigContext @@ -115,16 +110,6 @@ func installTemplate(root, name string) error { return nil } -func (config *AercConfig) LoadConfig(file *ini.File) error { - if triggers, err := file.GetSection("triggers"); err == nil { - if err := triggers.MapTo(&config.Triggers); err != nil { - return err - } - } - - return nil -} - func LoadConfigFromFile(root *string, accts []string) (*AercConfig, error) { if root == nil { _root := path.Join(xdg.ConfigHome(), "aerc") @@ -177,7 +162,7 @@ func LoadConfigFromFile(root *string, accts []string) (*AercConfig, error) { if err := config.parseOpeners(file); err != nil { return nil, err } - if err = config.LoadConfig(file); err != nil { + if err := config.parseTriggers(file); err != nil { return nil, err } if err := config.parseUi(file); err != nil { @@ -186,9 +171,6 @@ func LoadConfigFromFile(root *string, accts []string) (*AercConfig, error) { if err := config.parseGeneral(file); err != nil { return nil, err } - - logging.Debugf("aerc.conf: [triggers] %#v", config.Triggers) - if err := config.parseTemplates(file); err != nil { return nil, err } -- cgit