Documentation
¶
Index ¶
- func IsTTY(fd uintptr) bool
- type Reporter
- type SilentReporter
- type TTYReporter
- type TestReporter
- func (t *TestReporter) Clear()
- func (t *TestReporter) GetMessages() []string
- func (t *TestReporter) Start()
- func (t *TestReporter) Stop()
- func (t *TestReporter) Update(message string)
- func (t *TestReporter) UpdateProgress(prefix string, current, total int, detail string)
- func (t *TestReporter) WasStarted() bool
- func (t *TestReporter) WasStopped() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Reporter ¶
type Reporter interface {
// Start initializes the reporter.
// Called at the beginning of the analysis pipeline.
Start()
// Update shows a simple status message.
// Example: status.Update("[PARSE] Discovering Go files...")
Update(message string)
// UpdateProgress shows a status message with progress counter.
// Example: status.UpdateProgress("[COVERAGE] Running tests", 5, 23, "pkg/name")
// Displays as: "[COVERAGE] Running tests... (5/23) pkg/name"
UpdateProgress(prefix string, current, total int, detail string)
// Clear removes the current status line from the display.
// Called before final output to ensure clean output.
Clear()
// Stop performs cleanup and finalizes the reporter.
// Called at the end of the analysis pipeline.
Stop()
}
Reporter is the interface for progress reporting during analysis.
Components can use this interface to report their status without coupling to specific output implementations. The orchestrator creates an appropriate implementation based on configuration and TTY detection.
Implementations:
- TTYReporter: Shows live updates to stderr when running in a terminal
- SilentReporter: No-op implementation for non-TTY or quiet mode
- TestReporter: Captures messages for testing
func NewReporter ¶
func NewReporter(cfg *config.OutputConfig) Reporter
NewReporter creates an appropriate Reporter based on configuration and TTY detection.
Returns:
- TTYReporter: If stderr is a TTY and status is enabled
- SilentReporter: If stderr is not a TTY, quiet mode is on, or output is redirected
Logic:
- If QuietMode is true: return SilentReporter
- If ShowStatus is true: return TTYReporter (force enable)
- If OutputFile is set: return SilentReporter (output redirected)
- If stderr is a TTY: return TTYReporter
- Otherwise: return SilentReporter (piped/redirected)
type SilentReporter ¶
type SilentReporter struct{}
SilentReporter implements Reporter with no-op methods. Used when output is piped, redirected, or quiet mode is enabled.
func NewSilentReporter ¶
func NewSilentReporter() *SilentReporter
NewSilentReporter creates a new SilentReporter.
func (*SilentReporter) UpdateProgress ¶
func (s *SilentReporter) UpdateProgress(prefix string, current, total int, detail string)
UpdateProgress is a no-op.
type TTYReporter ¶
type TTYReporter struct {
// contains filtered or unexported fields
}
TTYReporter implements Reporter for terminal output. Writes live status updates to stderr using single-line overwrites.
func (*TTYReporter) Clear ¶
func (t *TTYReporter) Clear()
Clear removes the current status line from stderr.
func (*TTYReporter) Start ¶
func (t *TTYReporter) Start()
Start initializes the reporter (no-op for TTY).
func (*TTYReporter) Stop ¶
func (t *TTYReporter) Stop()
Stop performs cleanup (clears the line and prints newline).
func (*TTYReporter) Update ¶
func (t *TTYReporter) Update(message string)
Update writes a simple status message to stderr. Uses \r to overwrite the current line.
func (*TTYReporter) UpdateProgress ¶
func (t *TTYReporter) UpdateProgress(prefix string, current, total int, detail string)
UpdateProgress writes a status message with progress counter. Format: "{prefix}... ({current}/{total}) {detail}"
type TestReporter ¶
type TestReporter struct {
// contains filtered or unexported fields
}
TestReporter implements Reporter for testing. Captures all status messages in a slice for verification.
func NewTestReporter ¶
func NewTestReporter() *TestReporter
NewTestReporter creates a new TestReporter.
func (*TestReporter) GetMessages ¶
func (t *TestReporter) GetMessages() []string
GetMessages returns all captured messages.
func (*TestReporter) Start ¶
func (t *TestReporter) Start()
Start records that the reporter was started.
func (*TestReporter) Stop ¶
func (t *TestReporter) Stop()
Stop records that the reporter was stopped.
func (*TestReporter) Update ¶
func (t *TestReporter) Update(message string)
Update captures a simple status message.
func (*TestReporter) UpdateProgress ¶
func (t *TestReporter) UpdateProgress(prefix string, current, total int, detail string)
UpdateProgress captures a progress message.
func (*TestReporter) WasStarted ¶
func (t *TestReporter) WasStarted() bool
WasStarted returns whether Start() was called.
func (*TestReporter) WasStopped ¶
func (t *TestReporter) WasStopped() bool
WasStopped returns whether Stop() was called.