mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-01-26 11:14:04 +00:00
- Add interactive configuration wizard with auto-detection and multi-format export - Implement contextual error system with 14 error codes and actionable suggestions - Add centralized progress indicators with consistent theming - Fix all cyclomatic complexity issues (8 functions refactored) - Eliminate code duplication with centralized utilities and error handling - Add comprehensive test coverage for all new components - Update TODO.md with completed tasks and accurate completion dates
51 lines
1.4 KiB
Go
51 lines
1.4 KiB
Go
// Package internal provides progress bar utilities for the gh-action-readme tool.
|
|
package internal
|
|
|
|
import (
|
|
"github.com/schollz/progressbar/v3"
|
|
)
|
|
|
|
// ProgressBarManager handles progress bar creation and management.
|
|
type ProgressBarManager struct {
|
|
quiet bool
|
|
}
|
|
|
|
// NewProgressBarManager creates a new progress bar manager.
|
|
func NewProgressBarManager(quiet bool) *ProgressBarManager {
|
|
return &ProgressBarManager{
|
|
quiet: quiet,
|
|
}
|
|
}
|
|
|
|
// CreateProgressBar creates a progress bar with standardized options.
|
|
func (pm *ProgressBarManager) CreateProgressBar(description string, total int) *progressbar.ProgressBar {
|
|
if total <= 1 || pm.quiet {
|
|
return nil
|
|
}
|
|
|
|
return progressbar.NewOptions(total,
|
|
progressbar.OptionSetDescription(description),
|
|
progressbar.OptionSetWidth(50),
|
|
progressbar.OptionShowCount(),
|
|
progressbar.OptionShowIts(),
|
|
progressbar.OptionSetTheme(progressbar.Theme{
|
|
Saucer: "=",
|
|
SaucerHead: ">",
|
|
SaucerPadding: " ",
|
|
BarStart: "[",
|
|
BarEnd: "]",
|
|
}))
|
|
}
|
|
|
|
// CreateProgressBarForFiles creates a progress bar for processing multiple files.
|
|
func (pm *ProgressBarManager) CreateProgressBarForFiles(description string, files []string) *progressbar.ProgressBar {
|
|
return pm.CreateProgressBar(description, len(files))
|
|
}
|
|
|
|
// FinishProgressBar completes the progress bar display.
|
|
func (pm *ProgressBarManager) FinishProgressBar(bar *progressbar.ProgressBar) {
|
|
if bar != nil {
|
|
_ = bar.Finish()
|
|
}
|
|
}
|