Documentation ¶
Index ¶
- Constants
- type Bar
- 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(total int64)
- 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 ¶
const ( // DefaultStyle is the default bar style DefaultStyle = "╢▌▌░╟" // SimpleStyle is simple style of bar, similar to the bar of wget SimpleStyle = "[=>-]" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bar ¶ added in v1.3.3
type Bar struct {
// contains filtered or unexported fields
}
Bar is a structure which defines the horizontal progress bar
func (*Bar) AddPercentage ¶ added in v1.3.3
AddPercentage adds percentage for bar, it's a coroutine safe function
func (*Bar) AddProgress ¶ added in v1.3.3
AddProgress add the progress of bar, it's a coroutine safe function
func (*Bar) IsFinished ¶ added in v1.3.3
IsFinished returns whether bar has done
func (*Bar) SetPercentage ¶ added in v1.3.3
SetPercentage sets the percentage of bar
func (*Bar) SetProgress ¶ added in v1.3.3
SetProgress set the progress of bar, it's a coroutine safe function
type EchelonNode ¶
type EchelonNode struct { // bar setting Pbar *Bar // contains filtered or unexported fields }
EchelonNode is a log node for interactive renderer, it is designed for coroutine safe object
It has title with specific title color. it's max visible lines can be specified. A node has children nodes.
func NewEchelonNode ¶
func NewEchelonNode(title string, width int, config *config.InteractiveRendererConfig) *EchelonNode
NewEchelonNode will create new EchelonNode, and set startTime the function calling time
func StartNewEchelonNode ¶
func StartNewEchelonNode(title string, width int, total int64, config *config.InteractiveRendererConfig) *EchelonNode
StartNewEchelonNode will create new EchelonNode with title and configuration, and start it.
func (*EchelonNode) AddNewChild ¶
func (node *EchelonNode) AddNewChild(child *EchelonNode)
AddNewChild will add child node for node. It's a coroutine safe function
func (*EchelonNode) AppendDescription ¶
func (node *EchelonNode) AppendDescription(text string)
AppendDescription will add text which might be multilines to node description, it won't start new line at the end of description. It's a coroutine safe function.
func (*EchelonNode) ClearAllChildren ¶
func (node *EchelonNode) ClearAllChildren()
ClearAllChildren will remove all children nodes of current node, it's a coroutine safe function
func (*EchelonNode) ClearDescription ¶
func (node *EchelonNode) ClearDescription()
ClearDescription will clean description of node, it will set description as a empty string list. it's a coroutine safe function
func (*EchelonNode) Complete ¶
func (node *EchelonNode) Complete()
Complete will stop a node. It's a coroutine safe function
func (*EchelonNode) CompleteWithColor ¶
func (node *EchelonNode) CompleteWithColor(status string, titleColor int)
CompleteWithColor will stop a node with specific status and color. It's a coroutine safe function
func (*EchelonNode) DescriptionLength ¶
func (node *EchelonNode) DescriptionLength() int
DescriptionLength returns the length of description of node. It's a coroutine safe function
func (*EchelonNode) ExecutionDuration ¶
func (node *EchelonNode) ExecutionDuration() time.Duration
ExecutionDuration will returns the spent time of node, it's a coroutine safe function
If the node is still in progress, it returns the passed time since the start of a node, else it returns the total time of a node spent.
func (*EchelonNode) FindOrCreateChild ¶
func (node *EchelonNode) FindOrCreateChild(childTitle string) *EchelonNode
FindOrCreateChild will return the last child node with specific node title if the node doesn't exist, it will create one. It's a coroutine safe function
func (*EchelonNode) GetChildren ¶
func (node *EchelonNode) GetChildren() []*EchelonNode
GetChildren will returns all childrens of node, it's a coroutine safe function
func (*EchelonNode) HasCompleted ¶
func (node *EchelonNode) HasCompleted() bool
HasCompleted returns wheter a node has completed, it's a coroutine safe function
func (*EchelonNode) HasStarted ¶
func (node *EchelonNode) HasStarted() bool
HasStarted returns wheter a node has started, a finished node is also started. This is a coroutine safe function
func (*EchelonNode) IsRunning ¶
func (node *EchelonNode) IsRunning() bool
IsRunning returns wheter a node is running, it's a coroutine safe function
func (*EchelonNode) Render ¶
func (node *EchelonNode) Render() []string
Render function will output the rendered text of a node, with it's sub nodes.
If the sub nodes lines are greater than max limitation, it will use '...' to replace some head lines.
func (*EchelonNode) SetDescription ¶
func (node *EchelonNode) SetDescription(description []string)
SetDescription will set description of node, it's a coroutine safe function.
func (*EchelonNode) SetStatus ¶
func (node *EchelonNode) SetStatus(text string)
SetStatus will set status off node, it's a coroutine safe function
func (*EchelonNode) SetTitleColor ¶
func (node *EchelonNode) SetTitleColor(ansiColor int)
SetTitleColor will set color of node title, it's a coroutine safe function
func (*EchelonNode) SetVisibleDescriptionLines ¶
func (node *EchelonNode) SetVisibleDescriptionLines(count int)
SetVisibleDescriptionLines will set max line number allowed to display for node. It's a coroutine safe function
func (*EchelonNode) Start ¶
func (node *EchelonNode) Start(total int64)
Start will start node, it sets the start time. It's a coroutine safe function
func (*EchelonNode) StartNewChild ¶
func (node *EchelonNode) StartNewChild(childName string) *EchelonNode
StartNewChild will create a child node with current node configuration for node
func (*EchelonNode) UpdateConfig ¶
func (node *EchelonNode) UpdateConfig(config *config.InteractiveRendererConfig)
UpdateConfig will update configuration of node, it's a coroutine safe function
func (*EchelonNode) UpdateTitle ¶
func (node *EchelonNode) UpdateTitle(text string)
UpdateTitle will update title of node, it's a coroutine safe function
func (*EchelonNode) WaitCompletion ¶
func (node *EchelonNode) WaitCompletion()
WaitCompletion will wait the node to complete, it won't wait child nodes