sprig library
(Go docs).
Tip
|
If you are reading this README on the Go Module Directory documentation (https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx) or the directory landing page (https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx), it may not render correctly. Be sure to view it at properly via the AsciiDoc rendering or by downloading and viewing the HTML version. |
CombinedFuncMap
github.com/Masterminds/sprig/v3.GenericFuncMap.
CombinedHtmlFuncMap
github.com/Masterminds/sprig/v3.HtmlFuncMap.
CombinedTxtFuncMap
github.com/Masterminds/sprig/v3.TxtFuncMap.
FuncMap
HtmlFuncMap
(html/template).FuncMap.
Nop
TxtFuncMap
(text/template).FuncMap.
dump
github.com/davecgh/go-spew/spew.Sdump
for whatever object(s) is/are passed to it.
metaIsNil
text/template.IsTrue and
html/template.IsTrue (expressed in
templates as `{{ if … }}`) leaves, as those functions/expressions return
false for e.g. `false` booleans AND nils.
numFloat32Str
numFloat64
numFloat64Str
numFloatStr
osFQDN
os.Hostname.
os.Hostname, use
[`osHostname`](#fn_os_hstnm).
osGroupById
os/user.Group from a given group ID/GID.
os/user.LookupGroupId, except it will
accept either a `string` **or** an `int` as the GID.
osGroupByName
os/user.Group from a given group name.
os/user.LookupGroup.
osHost
os.Hostname and returning the first
"host label" (as RFCs refer to it).
Tip
|
The |
os.Hostname, use
[`osHostname`](#fn_os_hstnm).
osHostname
os.Hostname.
osIdState
r00t2.io/sysutils.IDState.
r00t2.io/sysutils.GetIDState.
Warning
|
This is more or less useless on Windows; it returns only a dummy struct for cross-platform compatibility. |
osUser
os/user.User.
os/user.Current.
osUserById
os/user.User from a given user ID/UID.
os/user.LookupId, except it will accept
either a `string` **or** an `int` as the UID.
osUserByName
os/user.User from a given username.
os/user.Lookup.
path stdlib library and use a fixed `/` path separator.
pathJoin
path.Join.
Warning
|
If you are joining paths in a pipeline, you almost assuredly want |
pathPipeJoin
pathSliceJoin
Tip
|
The |
pathSlicePipeJoin
Tip
|
The |
pathSubJoin
path/filepath stdlib library, and
use the OS-specific
os.PathSeparator.
Warning
|
Take special note of the oddness around specifying Windows paths and
drive letters in e.g. It is recommended to make use of |
osPathJoin
path/filepath.Join.
Warning
|
If you are joining paths in a pipeline, you almost assuredly want |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathPipeJoin
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSep
os.PathSeparator for this OS.
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSliceJoin
Tip
|
The |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSlicePipeJoin
Tip
|
The |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSubJoin
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
github.com/shirou/gopsutil/v4 packages.
psCpuCnts
github.com/shirou/gopsutil/v4/cpu.Counts.
psCpuInfo
github.com/shirou/gopsutil/v4/cpu.Info.
psCpuPct
github.com/shirou/gopsutil/v4/cpu.Percent.
psCpuTimes
github.com/shirou/gopsutil/v4/cpu.Times.
psDiskIoCnts
github.com/shirou/gopsutil/v4/disk.IOCounters.
psDiskLabel
github.com/shirou/gopsutil/v4/disk.Label.
psDiskParts
github.com/shirou/gopsutil/v4/disk.Partitions.
psDiskSerial
github.com/shirou/gopsutil/v4/disk.SerialNumber.
psDiskUsage
github.com/shirou/gopsutil/v4/disk.Usage.
psHostBoot
github.com/shirou/gopsutil/v4/host.BootTime.
psHostId
github.com/shirou/gopsutil/v4/host.HostID.
psHostInfo
github.com/shirou/gopsutil/v4/host.Info.
psHostKernArch
github.com/shirou/gopsutil/v4/host.KernelArch.
psHostKernVer
github.com/shirou/gopsutil/v4/host.KernelVersion.
psHostPlatInfo
github.com/shirou/gopsutil/v4/host.PlatformInformation.
psHostPlatUptime
github.com/shirou/gopsutil/v4/host.Uptime.
psHostUsers
github.com/shirou/gopsutil/v4/host.Users.
psHostPlatVirt
github.com/shirou/gopsutil/v4/host.Virtualization.
psLoadAvg
github.com/shirou/gopsutil/v4/load.Avg.
psLoadMisc
github.com/shirou/gopsutil/v4/load.Misc.
psMemExVMem
Warning
|
This function is available on Windows and Linux platforms only. |
Warning
|
This function returns very different types depending on platform.
|
psMemSwap
github.com/shirou/gopsutil/v4/mem.SwapMemory.
psMemSwapDevs
github.com/shirou/gopsutil/v4/mem.SwapDevices.
psMemVMem
github.com/shirou/gopsutil/v4/mem.VirtualMemory.
psNetConns
github.com/shirou/gopsutil/v4/net.Connections.
psNetConnsMax
github.com/shirou/gopsutil/v4/net.ConnectionsMax.
psNetConnsPid
github.com/shirou/gopsutil/v4/net.ConnectionsPid.
psNetConnsPidMax
github.com/shirou/gopsutil/v4/net.ConnectionsPidMax.
psNetCTStats
github.com/shirou/gopsutil/v4/net.ConntrackStats.
psNetCTStatList
github.com/shirou/gopsutil/v4/net.ConntrackStatList.
psNetFilterCnts
github.com/shirou/gopsutil/v4/net.FilterCounters.
psNetIoCnts
github.com/shirou/gopsutil/v4/net.IOCounters.
psNetIoCntsFile
github.com/shirou/gopsutil/v4/net.IOCountersByFile.
psNetIfaces
github.com/shirou/gopsutil/v4/net.Interfaces.
psNetPids
github.com/shirou/gopsutil/v4/net.Pids.
psNetProtoCnt
Warning
|
This only works properly on Linux currently per upstream. |
github.com/shirou/gopsutil/v4/net.ProtoCounters.
psNetRev
Warning
|
This function only exists on Linux. |
github.com/shirou/gopsutil/v4/net.Reverse.
psProcs
github.com/shirou/gopsutil/v4/proc.Processes.
psProcNew
github.com/shirou/gopsutil/v4/proc.NewProcess.
psProcPids
github.com/shirou/gopsutil/v4/proc.Pids.
psProcPidExists
github.com/shirou/gopsutil/v4/proc.PidExists.
psSensorExTemp
Warning
|
This function only exists on Linux. |
psSensorTemps
github.com/shirou/gopsutil/v4/sensors.SensorsTemperatures.
Warning
|
All of these functions are only available on Windows. |
psWinsvcList
Warning
|
This function is only available on Windows. |
github.com/shirou/gopsutil/v4/winservices.ListServices.
psWinsvcNew
Warning
|
This function is only available on Windows. |
github.com/shirou/gopsutil/v4/winservices.NewService.
extIndent
Tip
|
If |
Note
|
Some of these functions duplicate Sprig functionality, but are included here for predictable API. Care has been taken to name these functions differently from the Sprig functions where possible and sensible. |
tmDate
time.Date.
tmFloatMicro
(r00t2.io/goutils/timex).F64Microseconds.
tmFloatMilli
(r00t2.io/goutils/timex).F64Milliseconds.
tmFloatNano
(r00t2.io/goutils/timex).F64Nanoseconds.
tmFloat
(r00t2.io/goutils/timex).F64Seconds.
tmFmt
tmNow
time.Now.
tmParseDur8n
time.ParseDuration.
tmParseMonth
tmParseMonthInt
time.Month. `n` may be any numeric type
or a string representation of a number (or a custom type derived from
those).
time.Month constants in the `time`
module:
time.Now).
errors.Is; it will be wrapped by
[`(text/template).ExecError`](https://pkg.go.dev/text/template#ExecError)/[`(html/template).ExecError`](https://pkg.go.dev/html/template#ExecError).
tmParseMonthStr
time.Month.
time.Now).\`
tmParseTime
time.Parse.
sysArch
runtime.GOARCH constant.
sysNumCpu
runtime.NumCPU.
sysOsName
runtime.GOOS constant.
sysRuntime
runtime stdlib library.
Tip
|
The value type is a direct link to the Because all values are mapped as strings, they can be converted back to their native type via e.g. the Sprig conversion functions if necessary. |