Documentation
¶
Index ¶
- Constants
- func CatchExit(t Errorable, name string, want int)
- func Exit(code int)
- func HandleError(err error)
- func NewCommand(runnable Runnable, use, short, long string) *cobra.Command
- func PercentToHuman(percent float64, precision int) string
- func Recover()
- func SizeToHuman(size uint64) string
- type Error
- type ErrorExiter
- type Errorable
- type Errors
- type Runnable
Constants ¶
View Source
const ( OK = iota WARN CRIT UNKNOWN )
Variables ¶
This section is empty.
Functions ¶
func Exit ¶
func Exit(code int)
Exit behaves like os.Exit, but instead of exiting right away, it panic()s instead. This allows test code to capture exit calls, while the program can act as intended, by deferring Recover() at the beginning.
func HandleError ¶
func HandleError(err error)
func NewCommand ¶
NewCommand returns a now *cobra.Command suitable for self-contained configuration
func PercentToHuman ¶
PercentToHuman returns a string value of percentage, with at most a given precision
func SizeToHuman ¶
SizeToHuman converts byte size to IEC size string
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a sensu-aware error message, which knows about its criticality
type ErrorExiter ¶
type ErrorExiter interface { error Exit() }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.