-
Notifications
You must be signed in to change notification settings - Fork 268
Closed
Labels
Description
Objective
Configure spinners to write to os.Stderr instead of os.Stdout to follow CLI best practices and enable better output redirection.
Context
CLI tools should write:
- Progress indicators (spinners, status) → stderr
- Actual command output (data, results) → stdout
This allows users to redirect actual output while still seeing progress in the terminal.
Current Behavior
gh-aw logs download > output.txt
# Spinner output and actual output both mixed in fileDesired Behavior
gh-aw logs download > output.txt
# Spinner shows in terminal, only data goes to fileApproach
Update spinner initialization in pkg/console/spinner.go to use the WithWriter() option:
func NewSpinner(message string) *SpinnerWrapper {
// ... TTY detection ...
s := spinner.New(
spinner.CharSets[14],
100*time.Millisecond,
spinner.WithWriter(os.Stderr), // Add this option
)
// ... rest of setup ...
}Benefits
- Better piping: Users can redirect output without spinner interference
- Best practice alignment: Follows recommended CLI tool design
- Cleaner output: Progress indicators stay in terminal, data goes where directed
Files to Modify
pkg/console/spinner.go- Addspinner.WithWriter(os.Stderr)to initialization
Acceptance Criteria
- Spinner configured to write to stderr
- Spinner still displays correctly in terminal
- Output redirection works correctly (spinner in terminal, data to file)
- TTY detection behavior unchanged
- Existing tests pass
Testing
Manual test:
# Spinner should appear in terminal, only logs in file
gh-aw logs download > output.txt
# Check that output.txt contains only actual output
cat output.txtReferences
- Spinner WithWriter() documentation
- CLI best practices: (redacted)#the-basics
Related to [plan] Improve spinner implementation based on go-fan analysis #5100
AI generated by Plan Command for discussion #5094
Reactions are currently unavailable