Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Key string Message string Status MessageStatus ProgressMessage string Details string Created time.Time Started time.Time Finished time.Time }
func (Message) ElapsedSeconds ¶
type MessageRenderer ¶
type MessageRenderer struct {
// contains filtered or unexported fields
}
func NewMessageRenderer ¶
func NewMessageRenderer(config OutputConfig) *MessageRenderer
func (*MessageRenderer) RenderMessageStore ¶
func (mr *MessageRenderer) RenderMessageStore(ms *MessageStore)
type MessageStatus ¶
type MessageStatus string
const ( MessageStatusPending MessageStatus = "pending" MessageStatusStarted MessageStatus = "started" MessageStatusSuccess MessageStatus = "success" MessageStatusWarning MessageStatus = "warning" MessageStatusError MessageStatus = "error" MessageStatusSkipped MessageStatus = "skipped" MessageStatusUnknown MessageStatus = "unknown" )
func (MessageStatus) IsFinished ¶
func (ms MessageStatus) IsFinished() bool
func (MessageStatus) IsInProgress ¶
func (ms MessageStatus) IsInProgress() bool
func (MessageStatus) IsValid ¶
func (ms MessageStatus) IsValid() bool
type MessageStore ¶
type MessageStore struct {
// contains filtered or unexported fields
}
func NewMessageStore ¶
func NewMessageStore() *MessageStore
func (*MessageStore) Add ¶
func (ms *MessageStore) Add(msg Message) error
Add existing Message to Message store. Useful for adding, for example, historical data to MessageStore. For live data, prefer Push.
func (*MessageStore) Close ¶
func (ms *MessageStore) Close()
Close sets status of pending messages to skipped and started message to unknown.
func (*MessageStore) ListFinished ¶
func (ms *MessageStore) ListFinished() []*Message
ListFinished lists finished messages in MessageStore in order they were marked finished.
func (*MessageStore) ListInProgress ¶
func (ms *MessageStore) ListInProgress() []*Message
ListInprogress lists in-progress messages in MessageStore sorted by started time.
func (*MessageStore) Push ¶
func (ms *MessageStore) Push(update Update) error
Push update to MessageStore. Automatically creates/updates Message and sets it timestamps based on update content.
type OutputConfig ¶
type OutputConfig struct { DefaultTextWidth int DisableColors bool ForceColors bool ShowStatusIndicator bool StatusIndicatorMap map[MessageStatus]string FallbackStatusIndicatorMap map[MessageStatus]string StatusColorMap map[MessageStatus]Color InProgressAnimation []string FallbackInProgressAnimation []string UnknownColor Color UnknownIndicator string DetailsColor Color ColorMessage bool StopWatchcolor Color ShowStopwatch bool Target io.Writer }
func GetDefaultOutputConfig ¶
func GetDefaultOutputConfig() OutputConfig
func (OutputConfig) GetMaxHeight ¶
func (cfg OutputConfig) GetMaxHeight() int
GetMaxHeight returns target terminals height or, if determining terminal dimensions failed, zero.
func (OutputConfig) GetMaxWidth ¶
func (cfg OutputConfig) GetMaxWidth() int
GetMaxWidth returns target terminals width or, if determining terminal dimensions failed, default value from OutputConfig.
func (OutputConfig) GetMessageText ¶
func (cfg OutputConfig) GetMessageText(msg *Message, renderState RenderState) string