aboutsummaryrefslogtreecommitdiffstats
path: root/config/statusline.go
blob: a289c84de5b37fb623251f290cb33a24444ceef8 (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
32
33
package config

import (
	"git.sr.ht/~rjarry/aerc/logging"
	"github.com/go-ini/ini"
)

type StatuslineConfig struct {
	RenderFormat string `ini:"render-format"`
	Separator    string
	DisplayMode  string `ini:"display-mode"`
}

func defaultStatuslineConfig() StatuslineConfig {
	return StatuslineConfig{
		RenderFormat: "[%a] %S %>%T",
		Separator:    " | ",
		DisplayMode:  "",
	}
}

func (config *AercConfig) parseStatusline(file *ini.File) error {
	statusline, err := file.GetSection("statusline")
	if err != nil {
		goto out
	}
	if err := statusline.MapTo(&config.Statusline); err != nil {
		return err
	}
out:
	logging.Debugf("aerc.conf: [statusline] %#v", config.Statusline)
	return nil
}