ADDED:
* math, time functions to tplx/sprigx
FIXED:
* logging not initializing properly on some BSDs
This commit is contained in:
brent saner
2026-01-30 06:35:23 -05:00
parent 1bd6e1256c
commit 07e0e587fa
16 changed files with 6831 additions and 260 deletions

View File

@@ -6,6 +6,7 @@ import (
`path`
`path/filepath`
`runtime`
`time`
`github.com/davecgh/go-spew/spew`
`github.com/shirou/gopsutil/v4/cpu`
@@ -16,6 +17,7 @@ import (
psnet `github.com/shirou/gopsutil/v4/net`
`github.com/shirou/gopsutil/v4/process`
`github.com/shirou/gopsutil/v4/sensors`
`r00t2.io/goutils/timex`
`r00t2.io/sysutils`
)
@@ -28,6 +30,13 @@ var (
"Meta"/Template-Helpers
*/
"metaIsNil": metaIsNil,
/*
Numbers/Math
*/
"numFloat32Str": numFloat32Str,
"numFloat64": numFloat64,
"numFloat64Str": numFloat64Str,
"numFloatStr": numFloatStr,
/*
OS
*/
@@ -119,7 +128,21 @@ var (
"sysNumCpu": runtime.NumCPU,
"sysOsName": sysOsNm,
"sysRuntime": sysRuntime,
/*
Time/Dates/Timestamps
*/
"tmDate": time.Date,
"tmFmt": tmFmt,
"tmFloatMicro": timex.F64Microseconds,
"tmFloatMilli": timex.F64Milliseconds,
"tmFloatNano": timex.F64Nanoseconds,
"tmFloat": timex.F64Seconds,
"tmNow": time.Now,
"tmParseDur8n": time.ParseDuration,
"tmParseMonth": tmParseMonth,
"tmParseMonthInt": tmParseMonthInt,
"tmParseMonthStr": tmParseMonthStr,
"tmParseTime": time.Parse,
}
// htmlMap holds functions usable/intended for use in only an [html/template.FuncMap].