Documentation ¶
Index ¶
- type BannerOptions
- type Message
- func (m *Message) Banner(b BannerOptions)
- func (m *Message) Debug(prefix emoji.Emoji, rendered string)
- func (m *Message) Debugln(prefix emoji.Emoji, rendered string)
- func (m *Message) Failure(prefix emoji.Emoji, rendered string)
- func (m *Message) Failureln(prefix emoji.Emoji, rendered string)
- func (m *Message) HorizontalRuler()
- func (m *Message) Info(prefix emoji.Emoji, rendered string)
- func (m *Message) Infoln(prefix emoji.Emoji, rendered string)
- func (m *Message) Prompt(prefix emoji.Emoji, rendered string)
- func (m *Message) Promptln(prefix emoji.Emoji, rendered string)
- func (m *Message) SetColorMode(colorMode bool)
- func (m *Message) SetEmojiMode(emojiMode bool)
- func (m *Message) SetMessageTarget(target io.Writer)
- func (m *Message) SetSilentMode(silentMode bool)
- func (m *Message) SetVerboseMode(verboseMode bool)
- func (m *Message) Success(prefix emoji.Emoji, rendered string)
- func (m *Message) Successln(prefix emoji.Emoji, rendered string)
- func (m *Message) Title(prefix emoji.Emoji, rendered string)
- func (m *Message) Titleln(prefix emoji.Emoji, rendered string)
- func (m *Message) Warning(prefix emoji.Emoji, rendered string)
- func (m *Message) Warningln(prefix emoji.Emoji, rendered string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BannerOptions ¶
BannerOptions enables passing optional/additional information into the banner output. Values given here are only printed if Verbose Mode is active.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message struct holds the configurationg for messaging and you can call various methods on it that print messages.
func (*Message) Banner ¶
func (m *Message) Banner(b BannerOptions)
Banner prints information about the current application/command. Application name shown in magenta color, other info in gray/white. No-op if Silent Mode active. BannerOptions printed only if Verbose Mode active.
func (*Message) Debug ¶ added in v0.0.5
Debug prints a message in gray for debugging/testing purposes. No-op, unless Verbose Mode active.
func (*Message) Debugln ¶ added in v0.2.0
Debugln prints a message line in gray for debugging/testing purposes. No-op, unless Verbose Mode active.
func (*Message) Failure ¶ added in v0.0.5
Failure prints a message in red. Usefule for notifying user about errors. Printed always, even if Silent Mode active.
func (*Message) Failureln ¶ added in v0.2.0
Failureln prints a message line in red. Usefule for notifying user about errors. Printed always, even if Silent Mode active.
func (*Message) HorizontalRuler ¶ added in v0.0.5
func (m *Message) HorizontalRuler()
HorizontalRuler prints equals (=) characters as wide as the terminal.
func (*Message) Info ¶ added in v0.0.5
Info prints an informational message in white color. No-op if Silent Mode active.
func (*Message) Infoln ¶ added in v0.2.0
Infoln prints an informational message line in white color. No-op if Silent Mode active.
func (*Message) Prompt ¶ added in v0.0.5
Prompt prints a "prompt query/question" in cyan. Meant to be used for asking user input, just before reading stdin. Printed always, even if Silent Mode active.
NOTE: This method only prints the "prompt query/question" and does not actually read the stdin: You need to implement that yourself!
func (*Message) Promptln ¶ added in v0.2.0
Promptln prints a "prompt query/question" line in cyan. Meant to be used for asking user input, just before reading stdin. Printed always, even if Silent Mode active.
NOTE: This method only prints the "prompt query/question" and does not actually read the stdin: You need to implement that yourself!
func (*Message) SetColorMode ¶
SetColorMode controls if the messages are printed with emojis and colors. ColorMode is enabled (true) by default. May not have any effect if user has disabled color & emojis via environment variable. Or if user's terminal environment does not support colors.
func (*Message) SetEmojiMode ¶ added in v0.0.3
SetEmojiMode controls if emojis are printed with the messages: Can be disabled even when colors are enabled, but not enabled when colors are disabled.
func (*Message) SetMessageTarget ¶
SetMessageTarget overrides the default output target (tty/stderr). Mainly used for testing.
func (*Message) SetSilentMode ¶ added in v0.0.11
SetSilentMode controls if info/warning/success messages are shown or not (i.e. silent mode). Silent mode can not be enabled if verbose mode is active.
func (*Message) SetVerboseMode ¶
SetVerboseMode controls additional debug messages. Verbose output is disabled by default unless user has set VERBOSE or <APP_NAME>_VERBOSE environment variables. Enabling verbose mode also disables silent mode.
func (*Message) Success ¶ added in v0.0.5
Success prints a message in green. No-op if Silent Mode active.
func (*Message) Successln ¶ added in v0.2.0
Successln prints a message line in green. No-op if Silent Mode active.
func (*Message) Title ¶ added in v0.0.5
Title prints a heading message in blue color. No-op if Silent Mode active.
func (*Message) Titleln ¶ added in v0.2.0
Titleln prints a heading message line in blue color. No-op if Silent Mode active.