Documentation
¶
Overview ¶
Copyright (C) 2021-2023, Kubefirst
This program is licensed under MIT. See the LICENSE file for more details.
Index ¶
- func AddTracker(key string, title string, total int64) string
- func CreateTracker(title string, total int64) *progress.Tracker
- func GetInstance() *progressPrinter
- func IncrementTracker(key string, value int64)
- func LogMessage(message string)
- func SetupProgress(numTrackers int, silentMode bool)
- func TotalOfTrackers() int
- type ActionTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTracker ¶
AddTracker Add Tracker (prefered way) Return a string for the key to be used on future uses Sample of usage:
progressPrinter.AddTracker("step-base", "Apply Base ", 3)
no need to instanciate, it is a singleton, only one instance already started before use.
func CreateTracker ¶
CreateTracker Initialise a tracker object
Prefer `AddTracker` to create trackers, due to simplicity.
func GetInstance ¶
func GetInstance() *progressPrinter
GetInstance Function used to initialize the component once in the execution. Usually called from the `cmd` `init` func or as early as possible on the execution.
import ("github.com/kubefirst/runtime/pkg") func init() { progressPrinter.GetInstance() progressPrinter.SetupProgress(5) // Number of bars for the entire run. }
func IncrementTracker ¶
IncrementTracker Increments a tracker based on the provided key if key is unkown it will error out. Sample of usage:
progressPrinter.IncrementTracker("step-base", 1)
func LogMessage ¶
func LogMessage(message string)
LogMessage Prints a log message near the current active tracker. Sample of usage:
progressPrinter.LogMessage("- Waiting bootstrap")
func SetupProgress ¶
SetupProgress prepare the progress bar setting its initial configuration Used for general initialization of tracker object and overall counter
func TotalOfTrackers ¶
func TotalOfTrackers() int
TotalOfTrackers Returns the number of initialized Trackers
Types ¶
type ActionTracker ¶
ActionTracker Struct used to manage tracker object This object may evolve with more properties in th future when we have more fancier UI tools/styles.