Start the ProgressbarPrinter.
(title ...any)
| 283 | |
| 284 | // Start the ProgressbarPrinter. |
| 285 | func (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. |
| 310 | func (p *ProgressbarPrinter) Stop() (*ProgressbarPrinter, error) { |
no test coverage detected