You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bake/hclparser/stdlib.go
+115-2Lines changed: 115 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,13 @@ package hclparser
2
2
3
3
import (
4
4
"errors"
5
+
"math/big"
5
6
"os"
6
7
"os/user"
7
8
"path"
8
9
"path/filepath"
9
10
"runtime"
11
+
"strconv"
10
12
"strings"
11
13
"time"
12
14
@@ -63,7 +65,8 @@ var stdlibFunctions = []funcDef{
63
65
{name: "flatten", fn: stdlib.FlattenFunc},
64
66
{name: "floor", fn: stdlib.FloorFunc},
65
67
{name: "format", fn: stdlib.FormatFunc},
66
-
{name: "formatdate", fn: stdlib.FormatDateFunc},
68
+
{name: "formatdate", fn: stdlib.FormatDateFunc, descriptionAlt: `Deprecated: use formattimestamp instead. Formats a timestamp given in RFC 3339 syntax into another timestamp in some other machine-oriented time syntax, as described in the format string.`},
@@ -129,6 +132,7 @@ var stdlibFunctions = []funcDef{
129
132
{name: "trimspace", fn: stdlib.TrimSpaceFunc},
130
133
{name: "trimsuffix", fn: stdlib.TrimSuffixFunc},
131
134
{name: "try", fn: tryfunc.TryFunc, descriptionAlt: `Variadic function that tries to evaluate all of is arguments in sequence until one succeeds, in which case it returns that result, or returns an error if none of them succeed.`},
// formatTimestampFunc constructs a function that formats either an RFC3339
286
+
// timestamp string or a unix timestamp integer using the same format verbs as
287
+
// formatdate.
288
+
funcformatTimestampFunc() function.Function {
289
+
returnfunction.New(&function.Spec{
290
+
Description: `Formats a timestamp string in RFC 3339 syntax or a unix timestamp integer into another timestamp in some other machine-oriented time syntax, as described in the format string. The special format string "X" returns the unix timestamp in seconds.`,
Description: `Given a unix timestamp integer, will parse and return an object representation of that date and time. A unix timestamp is the number of seconds elapsed since January 1, 1970 UTC.`,
0 commit comments