aboutsummaryrefslogtreecommitdiffstats
path: root/config/config.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-11-15 22:53:20 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-16 16:12:11 +0100
commitc016a51900bfb26b536621039320f2485061dfc2 (patch)
tree46ff535788275bcdb0294f7018644c8ef0aa04d2 /config/config.go
parentf8e88632c49a4bd70efb503944f642e7daed37d8 (diff)
downloadaerc-c016a51900bfb26b536621039320f2485061dfc2.tar.gz
config: move [openers] parsing in separate file
The config.go file is getting too big. Move the aerc.conf [openers] section parsing logic into a dedicated openers.go file. No functional change. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/config/config.go b/config/config.go
index ef824279..20e28bd2 100644
--- a/config/config.go
+++ b/config/config.go
@@ -9,7 +9,6 @@ import (
"unicode"
"github.com/go-ini/ini"
- "github.com/google/shlex"
"github.com/kyoh86/xdg"
"github.com/mitchellh/go-homedir"
@@ -117,17 +116,6 @@ func installTemplate(root, name string) error {
}
func (config *AercConfig) LoadConfig(file *ini.File) error {
- if openers, err := file.GetSection("openers"); err == nil {
- for mimeType, command := range openers.KeysHash() {
- mimeType = strings.ToLower(mimeType)
- if args, err := shlex.Split(command); err != nil {
- return err
- } else {
- config.Openers[mimeType] = args
- }
- }
- }
-
if triggers, err := file.GetSection("triggers"); err == nil {
if err := triggers.MapTo(&config.Triggers); err != nil {
return err
@@ -186,6 +174,9 @@ func LoadConfigFromFile(root *string, accts []string) (*AercConfig, error) {
if err := config.parseStatusline(file); err != nil {
return nil, err
}
+ if err := config.parseOpeners(file); err != nil {
+ return nil, err
+ }
if err = config.LoadConfig(file); err != nil {
return nil, err
}
@@ -196,7 +187,6 @@ func LoadConfigFromFile(root *string, accts []string) (*AercConfig, error) {
return nil, err
}
- logging.Debugf("aerc.conf: [openers] %#v", config.Openers)
logging.Debugf("aerc.conf: [triggers] %#v", config.Triggers)
if err := config.parseTemplates(file); err != nil {