aboutsummaryrefslogtreecommitdiffstats
path: root/config/statusline.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-11-15 22:50:49 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-16 16:12:09 +0100
commitf8e88632c49a4bd70efb503944f642e7daed37d8 (patch)
tree0424095855417c868b96d44a773fe3e24f3dfbba /config/statusline.go
parent3710e459825b78a5adfa7af04128713010e4c9e4 (diff)
downloadaerc-f8e88632c49a4bd70efb503944f642e7daed37d8.tar.gz
config: move [statusline] in separate file
The config.go file is getting too big. Move the aerc.conf [statusline] section parsing logic into a dedicated statusline.go file. No functional change. Please ignore the casual "realignment" of fields in the default config initialization. Thanks gofmt. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'config/statusline.go')
-rw-r--r--config/statusline.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/config/statusline.go b/config/statusline.go
new file mode 100644
index 00000000..a289c84d
--- /dev/null
+++ b/config/statusline.go
@@ -0,0 +1,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
+}