Documentation ¶
Index ¶
- Constants
- type Clui
- func (c *Clui) Confidential(message string)
- func (c *Clui) Confidentialf(format string, a ...interface{})
- func (c *Clui) Error(message string)
- func (c *Clui) Errorf(format string, a ...interface{})
- func (c *Clui) Lifecycle(message string)
- func (c *Clui) Lifecyclef(format string, a ...interface{})
- func (c *Clui) Question(query string) (string, error)
- func (c *Clui) QuestionWithDefault(query string, defaultValue string) (string, error)
- func (c *Clui) Success(message string)
- func (c *Clui) Successf(format string, a ...interface{})
- func (c *Clui) Title(message string)
- func (c *Clui) Titlef(format string, a ...interface{})
- func (c *Clui) Warn(message string)
- func (c *Clui) Warnf(format string, a ...interface{})
- type Layout
- type MachineReadableLayout
- type MessageCategory
- type PlainLayout
- type UIColor
- type VerbosityLevel
Constants ¶
const ( // UIColorNone no color UIColorNone UIColor = 0 // UIColorRed red UIColorRed = 31 // UIColorGreen green UIColorGreen = 32 // UIColorYellow yellow UIColorYellow = 33 // UIColorBlue blue UIColorBlue = 34 // UIColorMagenta magenta UIColorMagenta = 35 // UIColorCyan cyan UIColorCyan = 36 // UIColorGray gray UIColorGray = 37 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clui ¶
type Clui struct { Layout Layout VerbosityLevel VerbosityLevel Interactive bool Color bool Reader io.Reader StdWriter io.Writer ErrorWriter io.Writer }
Clui is the actual message writer.
func DefaultClui ¶
func DefaultClui() *Clui
DefaultClui is the factory function for a Clui with default configuration.
func (*Clui) Confidential ¶
Confidential write a confidential message
func (*Clui) Confidentialf ¶
Confidentialf write a confidential message
func (*Clui) Lifecyclef ¶
Lifecyclef write a info message
func (*Clui) QuestionWithDefault ¶
QuestionWithDefault is a question to user with default value. Returns the default value if called in no-interactive mode.
type Layout ¶
type Layout interface { // Apply merge category and text. Apply(MessageCategory, string) string // SupportsColors returns if the Layout can render colored messages in the console. SupportsColors() bool }
Layout of the final message
type MachineReadableLayout ¶
type MachineReadableLayout struct{}
MachineReadableLayout layout for programmatic access
func (*MachineReadableLayout) Apply ¶
func (l *MachineReadableLayout) Apply(category MessageCategory, message string) string
Apply returns a comma separated string
func (*MachineReadableLayout) SupportsColors ¶
func (l *MachineReadableLayout) SupportsColors() bool
SupportsColors return always false
type MessageCategory ¶
type MessageCategory int8
MessageCategory classify the message
const ( // MessageCategoryConfidential confidential messages MessageCategoryConfidential MessageCategory = iota - 1 // MessageCategoryInfo info MessageCategoryInfo // MessageCategoryWarn warning MessageCategoryWarn // MessageCategoryError error MessageCategoryError // MessageCategoryQuestion question MessageCategoryQuestion )
type PlainLayout ¶
type PlainLayout struct{}
PlainLayout is the defaut and simplest Layout
func (*PlainLayout) Apply ¶
func (l *PlainLayout) Apply(category MessageCategory, message string) string
Apply returns the text message string
func (*PlainLayout) SupportsColors ¶
func (l *PlainLayout) SupportsColors() bool
SupportsColors returns always true
type VerbosityLevel ¶
type VerbosityLevel int8
VerbosityLevel of messages
const ( // VerbosityLevelMute mutes all messages VerbosityLevelMute VerbosityLevel = iota - 1 // VerbosityLevelLow allows warn and error VerbosityLevelLow // VerbosityLevelMedium allows lifecycle, success, warn and error VerbosityLevelMedium // VerbosityLevelHigh allows all messages VerbosityLevelHigh )