summaryrefslogtreecommitdiff
path: root/pkg/templates.go
diff options
context:
space:
mode:
authorJulien Dessaux2024-03-11 23:19:13 +0100
committerJulien Dessaux2024-03-11 23:19:13 +0100
commitb40723b0b8d482140c5152b22233c1b62ec7838d (patch)
treeeb1a7995c4e2d2c17ce9a98807aabed0ca3b81f2 /pkg/templates.go
parentfeat(gonf): bootstrapped the gonf cli (diff)
downloadgonf-b40723b0b8d482140c5152b22233c1b62ec7838d.tar.gz
gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.tar.bz2
gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.zip
chore(variables): support integer interpolation for all values
Diffstat (limited to 'pkg/templates.go')
-rw-r--r--pkg/templates.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/templates.go b/pkg/templates.go
index 0b7e11b..736bbe0 100644
--- a/pkg/templates.go
+++ b/pkg/templates.go
@@ -3,6 +3,7 @@ package gonf
import (
"bytes"
"log/slog"
+ "strconv"
"text/template"
)
@@ -38,7 +39,9 @@ func (t *TemplateValue) Bytes() []byte {
}
return t.contents
}
-
+func (t TemplateValue) Int() (int, error) {
+ return strconv.Atoi(t.String())
+}
func (t TemplateValue) String() string {
return string(t.Bytes()[:])
}