chore(variables): support integer interpolation for all values

This commit is contained in:
Julien Dessaux 2024-03-11 23:19:13 +01:00
parent acbccb0a93
commit b40723b0b8
Signed by: adyxax
GPG key ID: F92E51B86E07177E
4 changed files with 26 additions and 16 deletions

View file

@ -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()[:])
}