Documentation ¶
Index ¶
- func Execute()
- type ConsoleOutput
- func (c ConsoleOutput) Debug(msg string, a ...interface{})
- func (c ConsoleOutput) Fatal(err error, msg string, a ...interface{})
- func (c ConsoleOutput) Fatals(errs []error, msg string, a ...interface{})
- func (c ConsoleOutput) Info(msg string, a ...interface{})
- func (c ConsoleOutput) KeyValue(key, value string, indent int, a ...interface{})
- func (c ConsoleOutput) LineBreak()
- func (c ConsoleOutput) Say(msg string, indent int, a ...interface{})
- func (c ConsoleOutput) Table(header string, rows [][]string)
- func (c ConsoleOutput) Warn(msg string, a ...interface{})
- type Output
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsoleOutput ¶
ConsoleOutput implements a channel for sending messages to a user over standard output.
func (ConsoleOutput) Debug ¶
func (c ConsoleOutput) Debug(msg string, a ...interface{})
Debug prints a formatted message to standard output if `Verbose` is set to `true`. Messages are prefixed to indicate they are for debugging with :wrench: or [d].
Example ¶
consoleOutput.Debug("PC LOAD LETTER")
Output: [d] PC LOAD LETTER
func (ConsoleOutput) Fatal ¶
func (c ConsoleOutput) Fatal(err error, msg string, a ...interface{})
Fatal prints a formatted message and an error string to standard output Messages are prefixed to indicate they are fatals with :warning: or [!].
Example ¶
err := errors.New("OXY2_TANK_EXPLOSION") consoleOutput.Fatal(err, "Houston, we've had a problem.")
Output: [!] Houston, we've had a problem. - OXY2_TANK_EXPLOSION
func (ConsoleOutput) Fatals ¶
func (c ConsoleOutput) Fatals(errs []error, msg string, a ...interface{})
Fatals prints a formatted message and one or more error strings to standard output. Messages are prefixed to indicate they are fatals with :warning: or [!].
Example ¶
errs := []error{ errors.New("OXY2_TANK_EXPLOSION"), errors.New("PRIM_FUEL_CELL_FAILURE"), errors.New("SEC_FUEL_CELL_FAILURE"), } consoleOutput.Fatals(errs, "Houston, we've had a problem.")
Output: [!] Houston, we've had a problem. - OXY2_TANK_EXPLOSION - PRIM_FUEL_CELL_FAILURE - SEC_FUEL_CELL_FAILURE
func (ConsoleOutput) Info ¶
func (c ConsoleOutput) Info(msg string, a ...interface{})
Info prints a formatted message to standard output. Messages are prefixed to indicate they are informational with :information_source: or [i].
Example ¶
consoleOutput.Info("Welcome! Everything is %s.", "fine")
Output: [i] Welcome! Everything is fine.
func (ConsoleOutput) KeyValue ¶
func (c ConsoleOutput) KeyValue(key, value string, indent int, a ...interface{})
KeyValue prints a formatted, optionally indented key and value pair to standard output.
Example ¶
population := 468730 consoleOutput.KeyValue("Name", "Staten Island", 0) consoleOutput.KeyValue("County", "Richmond", 1) consoleOutput.KeyValue("Population", "%d", 1, population)
Output: Name: Staten Island County: Richmond Population: 468730
func (ConsoleOutput) LineBreak ¶
func (c ConsoleOutput) LineBreak()
LineBreak prints a single line break.
func (ConsoleOutput) Say ¶
func (c ConsoleOutput) Say(msg string, indent int, a ...interface{})
Say prints an optionally indented, formatted message followed by a line break to standard output.
Example ¶
username := "Werner Brandes" consoleOutput.Say("Hi, my name is %s. My voice is my passport. Verify Me.", 0, username)
Output: Hi, my name is Werner Brandes. My voice is my passport. Verify Me.
func (ConsoleOutput) Table ¶
func (c ConsoleOutput) Table(header string, rows [][]string)
Table prints a formatted table with optional header to standard output.
Example ¶
rows := [][]string{ {"NAME", "ALLEGIANCE"}, {"Butterbumps", "House Tyrell"}, {"Jinglebell", "House Frey"}, {"Moon Boy", "House Baratheon"}, } consoleOutput.Table("Fools of Westeros", rows)
Output: Fools of Westeros NAME ALLEGIANCE Butterbumps House Tyrell Jinglebell House Frey Moon Boy House Baratheon
func (ConsoleOutput) Warn ¶
func (c ConsoleOutput) Warn(msg string, a ...interface{})
Warn prints a formatted message to standard output. Messages are prefixed to indicate they are warnings with :warning: or [!].
Example ¶
consoleOutput.Warn("Keep it secret, keep it safe.")
Output: [!] Keep it secret, keep it safe.
type Output ¶
type Output interface { Debug(string, ...interface{}) Fatal(error, string, ...interface{}) Fatals([]error, string, ...interface{}) Info(string, ...interface{}) KeyValue(string, string, int, ...interface{}) LineBreak() Say(string, int, ...interface{}) Table(string, [][]string) Warn(string, ...interface{}) }
Output represents a channel for sending messages to a user.