Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Done ¶
func Done()
Done stops the active spinner and prints a success line. When called inside a WithProgress block, it is a no-op.
func Fail ¶
func Fail()
Fail stops the active spinner and prints a failure line. When called inside a WithProgress block, it is a no-op.
func Init ¶
func Init(verbose bool)
Init configures Active for the current run mode. In verbose mode, Active is set to a verboseSpinner that prints messages without animation.
func Pause ¶
func Pause()
Pause stops the spinner animation without printing Done or Fail. Use before handing the terminal to an interactive subprocess; call Resume after it exits.
func PauseWithMessage ¶
func PauseWithMessage()
PauseWithMessage stops the spinner animation and prints a static progress line once. Use this for interactive prompts where the current progress context should stay visible.
func SectionHeader ¶
SectionHeader returns a fixed-width section label padded with ─ characters. Example: SectionHeader("Kustomize: gitops") → "── Kustomize: gitops ──────────────────────────────────────"
func Start ¶
func Start(message string)
Start begins a new progress spinner with the given message. When called inside a WithProgress block, it is a no-op so the layer message is preserved.
func Update ¶
func Update(message string)
Update changes the suffix on the currently active spinner.
func WithProgress ¶
WithProgress runs fn with a progress spinner showing message. Increments the nesting depth so that any Start/Done/Fail calls inside fn are suppressed — only this layer's Done or Fail line is printed. When already inside a WithProgress block, fn is run directly without spinner management.
Types ¶
type MockSpinner ¶
type MockSpinner struct {
StartFunc func(message string)
UpdateFunc func(message string)
DoneFunc func()
FailFunc func()
PauseFunc func()
ResumeFunc func()
}
MockSpinner is a mock implementation of the Spinner interface for testing.
func NewMockSpinner ¶
func NewMockSpinner() *MockSpinner
NewMockSpinner creates a new MockSpinner instance.
func (*MockSpinner) Done ¶
func (m *MockSpinner) Done()
Done calls DoneFunc if set, otherwise does nothing.
func (*MockSpinner) Fail ¶
func (m *MockSpinner) Fail()
Fail calls FailFunc if set, otherwise does nothing.
func (*MockSpinner) Pause ¶
func (m *MockSpinner) Pause()
Pause calls PauseFunc if set, otherwise does nothing.
func (*MockSpinner) Resume ¶
func (m *MockSpinner) Resume()
Resume calls ResumeFunc if set, otherwise does nothing.
func (*MockSpinner) Start ¶
func (m *MockSpinner) Start(message string)
Start calls StartFunc if set, otherwise does nothing.
func (*MockSpinner) Update ¶
func (m *MockSpinner) Update(message string)
Update calls UpdateFunc if set, otherwise does nothing.
type Spinner ¶
type Spinner interface {
Start(message string)
Update(message string)
Done()
Fail()
Pause()
Resume()
}
Spinner is the interface for terminal progress feedback.
var Active Spinner = &termSpinner{}
Active is the live Spinner instance used by package-level functions. Replace this in tests or when switching to an alternative UI implementation.