Skip to content

Commit 4a35d81

Browse files
Merge pull request #372 from cloudnautique/main
enhance: add sys.date.now built in for time/date.
2 parents f0d8b31 + 0dec727 commit 4a35d81

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/builtin/builtin.go

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ import (
2626
)
2727

2828
var tools = map[string]types.Tool{
29+
"sys.time.now": {
30+
Parameters: types.Parameters{
31+
Description: "Returns the current date and time in RFC3339 format",
32+
},
33+
BuiltinFunc: SysTimeNow,
34+
},
2935
"sys.ls": {
3036
Parameters: types.Parameters{
3137
Description: "Lists the contents of a directory",
@@ -745,3 +751,7 @@ func SysPrompt(_ context.Context, _ []string, input string) (_ string, err error
745751

746752
return string(resultsStr), nil
747753
}
754+
755+
func SysTimeNow(ctx context.Context, env []string, input string) (string, error) {
756+
return time.Now().Format(time.RFC3339), nil
757+
}

0 commit comments

Comments
 (0)