From b40723b0b8d482140c5152b22233c1b62ec7838d Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 11 Mar 2024 23:19:13 +0100 Subject: chore(variables): support integer interpolation for all values --- pkg/templates.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkg/templates.go') 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()[:]) } -- cgit v1.2.3