Output destination routing and optional paging
Problem
When running unbounded or large enumerations like --expr "tri(n)" --max-n 100000, the output floods the terminal and the user loses shell history. Users can pipe to less or redirect to a file, but:
- They have to know to do that before running the command
- There's no built-in way to write to both stdout and file simultaneously (tee)
- Clipboard output is useful for quick results but requires external tools
- A built-in pager or buffer would let users maintain control of their terminal without pre-planning
Proposal
Add --output / -o flag supporting multiple destinations, modeled on the listall.py pattern from Z:\OmniTools\listall:
--output stdout (default, current behavior)
--output file (write to auto-timestamped file)
--output clip (copy to clipboard)
--output all (all three)
--output file,stdout (comma-separated for specific combos)
Optional: --filename / -F for custom output filename when using --output file.
Buffer / Pager Concept (research)
The more speculative part: should we buffer large enumerations and present them through a pager (like less) by default when output exceeds a threshold? Arguments:
For built-in paging:
- Protects users from runaway stdout filling their terminal
- No pre-planning needed ("I forgot to pipe to less")
- Could integrate with
--limit as a soft vs. hard cap
Against built-in paging:
- Users can already
| less or | head
- Pager behavior varies across platforms (Windows vs. Unix)
- Adding pager logic to a math tool is scope creep
--limit N already provides a hard cap
This may be best left as a "document the pattern" rather than implement — show users in help/docs that | less and > file.txt are the recommended approaches for large output, and keep --output file as the built-in alternative.
Reference
The Z:\OmniTools\listall\listall.py output routing:
output_results() function (lines 572-592): multi-destination router
--output uses action="append" with set-based expansion ("all" → {clip, stdout, file})
- Auto-timestamped filenames:
listall_25.01.13_14-30_EST.txt
- Content fully assembled in memory, then routed — no streaming/paging
Placement
v1.0 milestone — fits under "Stable CLI interface" alongside output formatting (#55) and enhanced JSON (#35). The output routing is a CLI maturity feature, not a math/enumeration feature.
Related Issues
Output destination routing and optional paging
Problem
When running unbounded or large enumerations like
--expr "tri(n)" --max-n 100000, the output floods the terminal and the user loses shell history. Users can pipe tolessor redirect to a file, but:Proposal
Add
--output/-oflag supporting multiple destinations, modeled on thelistall.pypattern fromZ:\OmniTools\listall:Optional:
--filename/-Ffor custom output filename when using--output file.Buffer / Pager Concept (research)
The more speculative part: should we buffer large enumerations and present them through a pager (like
less) by default when output exceeds a threshold? Arguments:For built-in paging:
--limitas a soft vs. hard capAgainst built-in paging:
| lessor| head--limit Nalready provides a hard capThis may be best left as a "document the pattern" rather than implement — show users in help/docs that
| lessand> file.txtare the recommended approaches for large output, and keep--output fileas the built-in alternative.Reference
The
Z:\OmniTools\listall\listall.pyoutput routing:output_results()function (lines 572-592): multi-destination router--outputusesaction="append"with set-based expansion ("all"→{clip, stdout, file})listall_25.01.13_14-30_EST.txtPlacement
v1.0 milestone — fits under "Stable CLI interface" alongside output formatting (#55) and enhanced JSON (#35). The output routing is a CLI maturity feature, not a math/enumeration feature.
Related Issues