Documentation
¶
Overview ¶
Package node implements the goroutine-safe tree node behind the interactive renderer.
Index ¶
- type EchelonNode
- func (node *EchelonNode) AddNewChild(child *EchelonNode)
- func (node *EchelonNode) AppendDescription(text string)
- func (node *EchelonNode) ClearAllChildren()
- func (node *EchelonNode) ClearDescription()
- func (node *EchelonNode) Complete()
- func (node *EchelonNode) CompleteWithColor(status string, titleColor int)
- func (node *EchelonNode) DescriptionLength() int
- func (node *EchelonNode) ExecutionDuration() time.Duration
- func (node *EchelonNode) FindOrCreateChild(childTitle string) *EchelonNode
- func (node *EchelonNode) GetChildren() []*EchelonNode
- func (node *EchelonNode) HasCompleted() bool
- func (node *EchelonNode) HasStarted() bool
- func (node *EchelonNode) IsRunning() bool
- func (node *EchelonNode) Render() []string
- func (node *EchelonNode) SetDescription(description []string)
- func (node *EchelonNode) SetStatus(text string)
- func (node *EchelonNode) SetTitleColor(ansiColor int)
- func (node *EchelonNode) SetVisibleDescriptionLines(count int)
- func (node *EchelonNode) Start()
- func (node *EchelonNode) StartNewChild(childName string) *EchelonNode
- func (node *EchelonNode) UpdateConfig(config *config.InteractiveRendererConfig)
- func (node *EchelonNode) UpdateTitle(text string)
- func (node *EchelonNode) WaitCompletion()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EchelonNode ¶
type EchelonNode struct {
// contains filtered or unexported fields
}
EchelonNode is one tree node: title, spinner/status, duration, description lines, and children. All methods are goroutine-safe.
func NewEchelonNode ¶
func NewEchelonNode(title string, config *config.InteractiveRendererConfig) *EchelonNode
NewEchelonNode creates a paused node with the neutral title color.
func StartNewEchelonNode ¶
func StartNewEchelonNode(title string, config *config.InteractiveRendererConfig) *EchelonNode
StartNewEchelonNode creates a node and starts it immediately.
func (*EchelonNode) AddNewChild ¶
func (node *EchelonNode) AddNewChild(child *EchelonNode)
AddNewChild attaches an existing child node.
func (*EchelonNode) AppendDescription ¶
func (node *EchelonNode) AppendDescription(text string)
AppendDescription merges text into the description, joining the first new line onto the last existing one (streaming writes rarely end cleanly).
func (*EchelonNode) ClearAllChildren ¶
func (node *EchelonNode) ClearAllChildren()
ClearAllChildren drops all child nodes.
func (*EchelonNode) ClearDescription ¶
func (node *EchelonNode) ClearDescription()
ClearDescription drops all description lines.
func (*EchelonNode) Complete ¶
func (node *EchelonNode) Complete()
Complete completes the node keeping its status glyph.
func (*EchelonNode) CompleteWithColor ¶
func (node *EchelonNode) CompleteWithColor(status string, titleColor int)
CompleteWithColor completes the node with a status glyph and title color.
func (*EchelonNode) DescriptionLength ¶
func (node *EchelonNode) DescriptionLength() int
DescriptionLength returns the description line count.
func (*EchelonNode) ExecutionDuration ¶
func (node *EchelonNode) ExecutionDuration() time.Duration
ExecutionDuration returns how long the node ran (or has run so far).
func (*EchelonNode) FindOrCreateChild ¶
func (node *EchelonNode) FindOrCreateChild(childTitle string) *EchelonNode
FindOrCreateChild returns the last child with the title, creating it first.
func (*EchelonNode) GetChildren ¶
func (node *EchelonNode) GetChildren() []*EchelonNode
GetChildren returns the child nodes.
func (*EchelonNode) HasCompleted ¶
func (node *EchelonNode) HasCompleted() bool
HasCompleted reports whether the node completed.
func (*EchelonNode) HasStarted ¶
func (node *EchelonNode) HasStarted() bool
HasStarted reports whether the node started.
func (*EchelonNode) IsRunning ¶
func (node *EchelonNode) IsRunning() bool
IsRunning reports whether the node started but not completed.
func (*EchelonNode) Render ¶
func (node *EchelonNode) Render() []string
Render returns the node lines: fancy title, children, then the description tail (truncated with "..." when over the visible cap).
func (*EchelonNode) SetDescription ¶
func (node *EchelonNode) SetDescription(description []string)
SetDescription replaces the description lines.
func (*EchelonNode) SetStatus ¶
func (node *EchelonNode) SetStatus(text string)
SetStatus replaces the status glyph.
func (*EchelonNode) SetTitleColor ¶
func (node *EchelonNode) SetTitleColor(ansiColor int)
SetTitleColor replaces the ANSI title color.
func (*EchelonNode) SetVisibleDescriptionLines ¶
func (node *EchelonNode) SetVisibleDescriptionLines(count int)
SetVisibleDescriptionLines caps rendered description lines.
func (*EchelonNode) StartNewChild ¶
func (node *EchelonNode) StartNewChild(childName string) *EchelonNode
StartNewChild creates, starts, and attaches a child node.
func (*EchelonNode) UpdateConfig ¶
func (node *EchelonNode) UpdateConfig(config *config.InteractiveRendererConfig)
UpdateConfig replaces the node config.
func (*EchelonNode) UpdateTitle ¶
func (node *EchelonNode) UpdateTitle(text string)
UpdateTitle replaces the node title.
func (*EchelonNode) WaitCompletion ¶
func (node *EchelonNode) WaitCompletion()
WaitCompletion blocks until the node completes.