MCPcopy Index your code
hub / github.com/pterm/pterm / Start

Method Start

progressbar_printer.go:285–307  ·  view source on GitHub ↗

Start the ProgressbarPrinter.

(title ...any)

Source from the content-addressed store, hash-verified

283
284// Start the ProgressbarPrinter.
285func (p ProgressbarPrinter) Start(title ...any) (*ProgressbarPrinter, error) {
286 cursor.Hide()
287 if RawOutput && p.ShowTitle {
288 Fprintln(p.Writer, p.Title)
289 }
290 p.IsActive = true
291 if len(title) != 0 {
292 p.Title = Sprint(title...)
293 }
294 ActiveProgressBarPrinters = append(ActiveProgressBarPrinters, &p)
295 p.startedAt = time.Now()
296
297 p.updateProgress()
298
299 if p.ShowElapsedTime {
300 p.rerenderTask = schedule.Every(time.Second, func() bool {
301 p.updateProgress()
302 return true
303 })
304 }
305
306 return &p, nil
307}
308
309// Stop the ProgressbarPrinter.
310func (p *ProgressbarPrinter) Stop() (*ProgressbarPrinter, error) {

Callers 1

GenericStartMethod · 0.95

Calls 3

updateProgressMethod · 0.95
FprintlnFunction · 0.85
SprintFunction · 0.85

Tested by

no test coverage detected