diff options
Diffstat (limited to 'config/openers.go')
-rw-r--r-- | config/openers.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/config/openers.go b/config/openers.go new file mode 100644 index 00000000..d41c5455 --- /dev/null +++ b/config/openers.go @@ -0,0 +1,29 @@ +package config + +import ( + "strings" + + "git.sr.ht/~rjarry/aerc/logging" + "github.com/go-ini/ini" + "github.com/google/shlex" +) + +func (config *AercConfig) parseOpeners(file *ini.File) error { + openers, err := file.GetSection("openers") + if err != nil { + goto out + } + + 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 + } + } + +out: + logging.Debugf("aerc.conf: [openers] %#v", config.Openers) + return nil +} |