From dfc048fe285939d9de3b5753f723c935d042cc2b Mon Sep 17 00:00:00 2001 From: Daniel Bridges Date: Mon, 15 Jul 2019 11:56:44 -0700 Subject: Display user specified headers in viewer if present --- config/config.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'config/config.go') diff --git a/config/config.go b/config/config.go index aab3905..9e081fd 100644 --- a/config/config.go +++ b/config/config.go @@ -79,7 +79,8 @@ type FilterConfig struct { type ViewerConfig struct { Pager string Alternatives []string - ShowHeaders bool `ini:"show-headers"` + ShowHeaders bool `ini:"show-headers"` + HeaderLayout [][]string `ini:"-"` } type AercConfig struct { @@ -261,6 +262,8 @@ func (config *AercConfig) LoadConfig(file *ini.File) error { switch key { case "alternatives": config.Viewer.Alternatives = strings.Split(val, ",") + case "header-layout": + config.Viewer.HeaderLayout = parseLayout(val) } } } @@ -323,6 +326,18 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) { EmptyDirlist: "(no folders)", MouseEnabled: false, }, + + Viewer: ViewerConfig{ + Pager: "less -R", + Alternatives: []string{"text/plain", "text/html"}, + ShowHeaders: false, + HeaderLayout: [][]string{ + {"From", "To"}, + {"Cc", "Bcc"}, + {"Date"}, + {"Subject"}, + }, + }, } // These bindings are not configurable config.Bindings.AccountWizard.ExKey = KeyStroke{ @@ -431,3 +446,12 @@ func checkConfigPerms(filename string) error { } return nil } + +func parseLayout(layout string) [][]string { + rows := strings.Split(layout, ",") + l := make([][]string, len(rows)) + for i, r := range rows { + l[i] = strings.Split(r, "|") + } + return l +} -- cgit v1.2.3