Documentation
¶
Index ¶
- type Message
- type MessageManager
- func (m *MessageManager) AddError(message string)
- func (m *MessageManager) AddInfo(message string)
- func (m *MessageManager) AddSuccess(message string)
- func (m *MessageManager) AddWarning(message string)
- func (m *MessageManager) Clear()
- func (m *MessageManager) GetErrors() []string
- func (m *MessageManager) GetMessages() []Message
- func (m *MessageManager) HasErrors() bool
- func (m *MessageManager) HasMessages() bool
- func (m *MessageManager) HasNonErrorMessages() bool
- func (m *MessageManager) Render() string
- func (m *MessageManager) SetMaxWidth(width int)
- type MessageType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
Type MessageType
Content string
}
Message represents a single message with its type and content.
type MessageManager ¶
type MessageManager struct {
// contains filtered or unexported fields
}
MessageManager handles the collection and display of messages.
func NewManager ¶
func NewManager() *MessageManager
NewManager creates a new MessageManager instance.
func (*MessageManager) AddError ¶
func (m *MessageManager) AddError(message string)
AddError adds an error message to be displayed.
func (*MessageManager) AddInfo ¶
func (m *MessageManager) AddInfo(message string)
AddInfo adds an info message to be displayed.
func (*MessageManager) AddSuccess ¶
func (m *MessageManager) AddSuccess(message string)
AddSuccess adds a success message to be displayed.
func (*MessageManager) AddWarning ¶
func (m *MessageManager) AddWarning(message string)
AddWarning adds a warning message to be displayed.
func (*MessageManager) Clear ¶
func (m *MessageManager) Clear()
Clear removes all messages and resets display flags.
func (*MessageManager) GetErrors ¶
func (m *MessageManager) GetErrors() []string
GetErrors returns all error messages.
func (*MessageManager) GetMessages ¶
func (m *MessageManager) GetMessages() []Message
GetMessages returns all non-error messages.
func (*MessageManager) HasErrors ¶
func (m *MessageManager) HasErrors() bool
HasErrors returns true if there are error messages to display.
func (*MessageManager) HasMessages ¶
func (m *MessageManager) HasMessages() bool
HasMessages returns true if there are any messages to display.
func (*MessageManager) HasNonErrorMessages ¶
func (m *MessageManager) HasNonErrorMessages() bool
HasNonErrorMessages returns true if there are non-error messages to display.
func (*MessageManager) Render ¶
func (m *MessageManager) Render() string
Render returns the styled string representation of all messages. This method will be implemented after we create the message styles.
func (*MessageManager) SetMaxWidth ¶
func (m *MessageManager) SetMaxWidth(width int)
SetMaxWidth sets the container width used when rendering messages, so the boxes can shrink to fit narrow terminals. A value <= 0 keeps the style default.
type MessageType ¶
type MessageType int
MessageType represents the type of message to be displayed.
const ( Error MessageType = iota Success Warning Info )
func (MessageType) String ¶
func (t MessageType) String() string
String returns the string representation of the MessageType.