Description
When stdout is a TTY, format output as an aligned table with borders. When piped, stay CSV (preserving scriptability).
Examples
$ sql-pipe sales.csv 'SELECT region, SUM(amount) as total FROM orders GROUP BY region ORDER BY 2 DESC'
┌─────────┬───────────┐
│ region │ total │
├─────────┼───────────┤
│ AMER │ 203100.75 │
│ EMEA │ 142350.00 │
│ APAC │ 98210.50 │
└─────────┴───────────┘
# Piped output stays CSV — no behavior change for scripts
$ sql-pipe sales.csv 'SELECT ...' | grep AMER
AMER,203100.75
Acceptance Criteria
Notes
- Implementation: ~200-300 lines
- Auto-detect TTY (already done for "Loaded N rows" message)
- Buffer all rows, compute column widths, print table
- Consider row limit for table mode (e.g., first 1000 rows, then switch to CSV with warning)
- Negligible binary size impact (just string formatting)
Description
When stdout is a TTY, format output as an aligned table with borders. When piped, stay CSV (preserving scriptability).
Examples
Acceptance Criteria
--table/--no-tableflags for explicit controlNotes