aboutsummaryrefslogtreecommitdiffstats
path: root/config/openers.go
blob: 95273aa43d70718c7db1449e874d51a7aee4c4dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package config

import (
	"strings"

	"git.sr.ht/~rjarry/aerc/lib/log"
	"github.com/go-ini/ini"
)

type Opener struct {
	Mime string
	Args string
}

var Openers []Opener

func parseOpeners(file *ini.File) error {
	openers, err := file.GetSection("openers")
	if err != nil {
		goto out
	}

	for _, key := range openers.Keys() {
		mime := strings.ToLower(key.Name())
		Openers = append(Openers, Opener{Mime: mime, Args: key.Value()})
	}

out:
	log.Debugf("aerc.conf: [openers] %#v", Openers)
	return nil
}