Documentation ¶
Overview ¶
Package out contains simple functions to print messages out and maybe die.
Index ¶
- func BeginTabWrite() *tabwriter.Writer
- func BeginTabWriteTo(w io.Writer) *tabwriter.Writer
- func Die(msg string, args ...interface{})
- func DumpJSON(j interface{})
- func ErrAndMsg(code int16, msg *string) bool
- func Exit()
- func ExitErrJSON(j interface{}, msg string, args ...interface{})
- func ExitJSON(j interface{})
- func MaybeDie(err error, msg string, args ...interface{})
- func MaybeExitErrMsg(code int16, msg *string)
- type TabWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeginTabWrite ¶
BeginTabWrite returns a new tabwriter that prints to stdout.
func BeginTabWriteTo ¶
BeginTabWriteTo returns a new tabwriter that prints to w.
func Die ¶
func Die(msg string, args ...interface{})
Die prints a message to stderr and exits with 1.
func DumpJSON ¶
func DumpJSON(j interface{})
DumpJSON prints json to stderr. This exits with 1 if the input is unmarshalable.
func ErrAndMsg ¶
ErrAndMsg prints OK to stdout if code is 0, otherwise the error name to stderr as well as a message if non-nil.
This returns true if the code was an error.
func ExitErrJSON ¶
func ExitErrJSON(j interface{}, msg string, args ...interface{})
ExitErrJSON prints a message to stderr, dumps json to stdout, and exits with 1.
func MaybeExitErrMsg ¶
Types ¶
type TabWriter ¶ added in v0.6.0
TabWriter writes tab delimited output.
func NewTabWriter ¶ added in v0.6.0
func NewTabWriter() *TabWriter
NewTabWriter returns a TabWriter. For table formatted output, prefer NewTable. This function is meant to be used when you may want some column style output (i.e., headers on the left).
func NewTable ¶ added in v0.6.0
NewTable returns a TabWriter that is meant to output a "table". The headers are uppercased and immediately printed; Print can be used to append additional rows.
func (*TabWriter) Line ¶ added in v0.6.0
func (t *TabWriter) Line(sprint ...interface{})
Line prints a newline in our tab writer. This will reset tab spacing.
func (*TabWriter) Print ¶ added in v0.6.0
func (t *TabWriter) Print(args ...interface{})
Print stringifies the arguments and calls PrintStrings.
func (*TabWriter) PrintStrings ¶ added in v0.6.0
PrintStrings prints the arguments tab-delimited and newline-suffixed to the tab writer.