Documentation ¶
Index ¶
- func FormatKeyValue(key string, value string, separator string, keyPrefix string, maxKeyLength int) string
- func GenerateContent(details map[string]GetterFunc, separator string, keyPrefix string, ...) []string
- func GetDiskUsage() string
- func GetDistroName() string
- func GetHostname() string
- func GetKernelVersion() string
- func GetMemory() string
- func GetShell() string
- func GetUptime() string
- func GetUser() string
- func ParseExcludeFields(excludeFields string) []string
- type DefaultValues
- type GetterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatKeyValue ¶
func FormatKeyValue(key string, value string, separator string, keyPrefix string, maxKeyLength int) string
Format the key value into one string such that the key string should be of length 6 (since memory is the longest word) with 2 spaces in between the key and value.
func GenerateContent ¶
func GenerateContent(details map[string]GetterFunc, separator string, keyPrefix string, fieldsToExclude []string) []string
Generate an array of strings to print line by line when fetch is called.
func GetDistroName ¶
func GetDistroName() string
Get the Distro name Try to extract it from the lsb_release file If it's not there, try the os-release file Use the GOOS var as a fallback
func GetHostname ¶
func GetHostname() string
Get the hostname by reading it from the /etc/hostname file If the file is not accessible try using Go's os to get the hostname as a fallback.
func GetKernelVersion ¶
func GetKernelVersion() string
Extract the kernel version by reading the /proc/version file
func GetMemory ¶
func GetMemory() string
Extract the memory details of the system. The memory will be returned in the format <percent used>% of <total in GB>
func GetUptime ¶
func GetUptime() string
Get the uptime of the system based on the /proc/uptime file
func ParseExcludeFields ¶
Parse the exclude fields string to an array of string
Types ¶
type DefaultValues ¶
Store default values for the commandline args
func ArgsDefaultValues ¶
func ArgsDefaultValues() DefaultValues
type GetterFunc ¶
type GetterFunc func() string
GetterFunc will get the attribute and return it in a string