Documentation ¶
Overview ¶
Package util contains utilities for application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Exit = func(logrusInstance *logrus.Entry, msg string) { println("Fatal error, see log file") if logrusInstance != nil { logrusInstance.Fatalf(msg) } else { logrus.Fatal(msg) } }
Exit logs exit message to log and calls os.exit. This function can be overridden for testing purposes. LogrusInstance allows overriding default instance to pass additional arguments e.g. with logrus.WithField. It can also be set to nil.
Functions ¶
func DumpGoroutines ¶ added in v0.7.0
func DumpGoroutines() error
DumpGoroutines dumps all goroutines into a file in same directory as log file, with timestamped name.
func KeyBindingName ¶
ShortCutName returns name for given key
func OpenUrlInBrowser ¶ added in v0.5.0
OpenUrlInBrowser attempts to open given url in default browser
func PackKeyBindingName ¶
PackKeyBindingName returns shorter for given key Maxlength controls maximum length for text. If 0, disable limiting 'F6' -> F6 'Ctrl+Space' -> 'C-sp'
func SecToString ¶
Print seconds as formatted time: 50, 1:50, 0:05, 1.05, 1:05:05
func SecToStringApproximate ¶
SecToStringApproximate gives more verbal output for time duration 1:50 -> 2 min 10:50 -> 11 min 1:11:50 -> 1.1 h
Types ¶
This section is empty.