diff options
author | Julien Dessaux | 2024-03-11 23:19:13 +0100 |
---|---|---|
committer | Julien Dessaux | 2024-03-11 23:19:13 +0100 |
commit | b40723b0b8d482140c5152b22233c1b62ec7838d (patch) | |
tree | eb1a7995c4e2d2c17ce9a98807aabed0ca3b81f2 /pkg/templates.go | |
parent | feat(gonf): bootstrapped the gonf cli (diff) | |
download | gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.tar.gz gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.tar.bz2 gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.zip |
chore(variables): support integer interpolation for all values
Diffstat (limited to '')
-rw-r--r-- | pkg/templates.go | 5 |
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()[:]) } |