aboutsummaryrefslogtreecommitdiffstats
path: root/lib/templates
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-02-06 14:38:48 +0100
committerRobin Jarry <robin@jarry.cc>2023-02-20 14:48:42 +0100
commitd74400ac07a9f149e89fdf2b7232ffc6871f8553 (patch)
tree85b89c4a19d178ba755a1396159f087ea540922d /lib/templates
parentd2e74cdb91e140b50d14c3a8b315cde272f32587 (diff)
downloadaerc-d74400ac07a9f149e89fdf2b7232ffc6871f8553.tar.gz
templates: add compactDir function
This will be used in the dirtree-format replacement by templates. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'lib/templates')
-rw-r--r--lib/templates/functions.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/templates/functions.go b/lib/templates/functions.go
index 0b0a4546..1cbdc85d 100644
--- a/lib/templates/functions.go
+++ b/lib/templates/functions.go
@@ -246,6 +246,10 @@ func trimSignature(message string) string {
return res.String()
}
+func compactDir(path string) string {
+ return format.CompactPath(path, os.PathSeparator)
+}
+
var templateFuncs = template.FuncMap{
"quote": quote,
"wrapText": wrapText,
@@ -266,4 +270,5 @@ var templateFuncs = template.FuncMap{
"cwd": cwd,
"join": join,
"trimSignature": trimSignature,
+ "compactDir": compactDir,
}