Documentation ¶
Index ¶
- func Contains(a interface{}, e interface{}) bool
- func ExecQuiet(env []string, name string, args ...string) ([]byte, []byte, error)
- func ExecVerbose(env []string, name string, args ...string) (err error)
- func HashUint64(format string, a ...interface{}) uint64
- func IPaddr() (net.IP, error)
- func MarshalIndentXML(a interface{}, prefix string, indent string) (x []byte, err error)
- func MarshalXML(a interface{}) (x []byte, err error)
- func PrintErrorln(format string, a ...interface{})
- func PrintInfoln(format string, a ...interface{})
- func PrintMsgln(format string, a ...interface{})
- func PrintPlainln(format string, a ...interface{})
- func PrintWarnln(format string, a ...interface{})
- func ProgressStr(msg string, interval time.Duration) (chan<- struct{}, <-chan struct{})
- func RandomNap(dur time.Duration)
- func RandomString(n int) string
- func SplitDuration(d time.Duration) map[time.Duration]time.Duration
- func SplitMulti(s string, sep string) []string
- func UserOK(s string) bool
- type SysInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains(a interface{}, e interface{}) bool
Contains checks if the array a contains the element e. inspired by: https://stackoverflow.com/questions/10485743/contains-method-for-a-slice
func ExecQuiet ¶
ExecQuiet executes a shell command. It receives the environment, the name of the command and its arguments. It returns stdout and stderr as byte array
func ExecVerbose ¶
ExecVerbose executes a shell command and prints its stdout and stderr simultaneously. It receives the environment, the command name and its arguments.
func HashUint64 ¶
HashUint64 calculates the FNV hash of the input as uint64
func IPaddr ¶
IPaddr determines the preferred IP address of the current machine (inspired by https://stackoverflow.com/a/37382208)
func MarshalIndentXML ¶
MarshalIndentXML wraps xml.MarshalIndent() adding the prefix <?xml version="1.0"?>
func MarshalXML ¶
MarshalXML wraps xml.Marshal() adding the prefix <?xml version="1.0"?>
func PrintInfoln ¶
func PrintInfoln(format string, a ...interface{})
PrintInfoln prints an info text
func PrintPlainln ¶
func PrintPlainln(format string, a ...interface{})
PrintPlainln prints a plain text
func ProgressStr ¶
ProgressStr shows and moves a bar '...' on the command line. It can be used to show that an activity is ongoing. The parameter 'interval' steers the refresh rate (in milli seconds). The text in 'msg' is displayed in form of '...'. The progress bar is stopped by sending an empty struct to the returned channel:
chan <- struct{}{} close(chan)
func RandomString ¶
RandomString generates a random string og length n consisting of characters a-z, A-Z and 0-9.
func SplitDuration ¶
SplitDuration disaggregates a duration and returns it splitted into hours, minutes, seconds and nanoseconds
func SplitMulti ¶
SplitMulti slices s into all substrings separated by any character of sep and returns a slice of the substrings between those separators. If s does not contain any character of sep and sep is not empty, SplitMulti returns a slice of length 1 whose only element is s. If sep is empty, SplitMulti splits after each UTF-8 sequence. If both s and sep are empty, SplitMulti returns an empty slice.