aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-03-08 00:33:41 +0100
committerRobin Jarry <robin@jarry.cc>2023-03-08 00:43:05 +0100
commitc477d83f2493871b215aa2f8b2668b9b84fd6295 (patch)
treeab397640d4ba6dbe848a2f721e946f276d6daa6a /doc
parent56a6ed0cf71ecf55f37e94b574c41927452abc44 (diff)
downloadaerc-c477d83f2493871b215aa2f8b2668b9b84fd6295.tar.gz
templates: add switch/case functions
This allows much shorter templates. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/aerc-templates.7.scd9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/aerc-templates.7.scd b/doc/aerc-templates.7.scd
index 401c04e7..7f3d6410 100644
--- a/doc/aerc-templates.7.scd
+++ b/doc/aerc-templates.7.scd
@@ -392,6 +392,15 @@ aerc provides the following additional functions:
{{if match .Subject `^(\[[\w-]+\]\s*)?\[(RFC )?PATCH`}}{{.Style .Subject "cyan"}}{{else}}{{.Subject}}{{end}}
```
+*switch*
+ Do swich/case/default control flows. The switch value is compared with
+ regular expressions. If none of the case/default arms match, an empty
+ string is returned.
+
+ ```
+ {{switch .Folder (case `^INBOX$` "📥") (case `^Archive/.*` "🗃") (default "📁")}}
+ ```
+
*Function chaining*
All of the template functions can be chained together if needed.