aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-02-03 13:14:35 +0100
committerRobin Jarry <robin@jarry.cc>2023-02-20 14:48:42 +0100
commit6cfbc87d8ab0be8d264d81b0b1f26e7b96719dfc (patch)
treec09b6b671bd90504ce0e90512b39b31f650f37fb /lib
parentd74400ac07a9f149e89fdf2b7232ffc6871f8553 (diff)
downloadaerc-6cfbc87d8ab0be8d264d81b0b1f26e7b96719dfc.tar.gz
dirlist: use templates instead of % mini language
Replace dirlist-format with two settings: dirlist-left & dirlist-right. These two settings take aerc-templates(7) and may be left empty. Add automatic translation of dirlist-format to these new settings. Display a warning on startup if dirlist-format has been converted. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/state/templates.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/state/templates.go b/lib/state/templates.go
index f37c4865..2d5e39f5 100644
--- a/lib/state/templates.go
+++ b/lib/state/templates.go
@@ -1,6 +1,7 @@
package state
import (
+ "fmt"
"strings"
"time"
@@ -369,6 +370,19 @@ func (d *TemplateData) Exists(folders ...string) int {
return e
}
+func (d *TemplateData) RUE(folders ...string) string {
+ r, u, e := d.rue(folders...)
+ switch {
+ case r > 0:
+ return fmt.Sprintf("%d/%d/%d", r, u, e)
+ case u > 0:
+ return fmt.Sprintf("%d/%d", u, e)
+ case e > 0:
+ return fmt.Sprintf("%d", e)
+ }
+ return ""
+}
+
func (d *TemplateData) Connected() bool {
if d.state != nil {
return d.state.Connected