aboutsummaryrefslogblamecommitdiffstats
path: root/config/openers.go
blob: 31d99e9c1a8dd2fe93024ed92edf3a08102051e7 (plain) (tree)
1
2
3
4
5
6
7
8
9




                 
                                    
                               

 

                    
                   


                    

                                         




                                                  

                                                   
                                                                                


         
                                                       

                  
package config

import (
	"strings"

	"git.sr.ht/~rjarry/aerc/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
}