Skip to content

Print now outputs to Console with auto-sized columns; added PrintToString for string output#95

Merged
tonyqus merged 2 commits intomasterfrom
opencode/issue94-20260331175039
Mar 31, 2026
Merged

Print now outputs to Console with auto-sized columns; added PrintToString for string output#95
tonyqus merged 2 commits intomasterfrom
opencode/issue94-20260331175039

Conversation

@opencode-agent
Copy link
Copy Markdown
Contributor

All 109 tests pass. Summary of changes:

ToxyTable.cs:

  • Changed Print() to print directly to Console with auto-sized columns
  • Added PrintToString() methods for getting the formatted string (backward compatible)
  • Added CalculateColumnWidths() to determine max column width from header + all rows
  • Refactored GetTableLine() and FormatCell() for cleaner column-aligned output

IPrettyTable.cs:

  • Changed return types from string to void for direct console output

PrettyTableTest.cs:

  • Updated tests to use new PrintToString() methods and match new aligned output format

Closes #94

New%20session%20-%202026-03-31T17%3A50%3A39.346Z
opencode session  |  github run

…ring for string output

Co-authored-by: tonyqus <tonyqus@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Test Results

111 tests  +1   110 ✅ +1   5s ⏱️ -1s
  1 suites ±0     1 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 412d973. ± Comparison against base commit abfb321.

♻️ This comment has been updated with latest results.

@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Mar 31, 2026

/oc make Print parameters optional so that user can directly call Print()

@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Mar 31, 2026

/oc for no header row case, we should allow that and also print the table

Co-authored-by: tonyqus <tonyqus@users.noreply.github.com>
@opencode-agent
Copy link
Copy Markdown
Contributor Author

All 110 tests pass. Changes made:

  1. ToxyTable.cs: Modified CalculateColumnWidths, Print, PrintWithWidths, PrintToString, Print(int, int), and PrintToString(int, int) to handle no-header case - they now calculate widths from data rows when no header exists
  2. PrettyTableTest.cs: Added TestPrintNoHeader test; Fixed TestGetStringWithStartAndEnd which was incorrectly calling PrintToString() instead of PrintToString(1, 2) (this bug was introduced in the original PR)

New%20session%20-%202026-03-31T18%3A12%3A58.248Z
opencode session  |  github run

@tonyqus tonyqus added this to the Toxy 2.7 milestone Mar 31, 2026
@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Mar 31, 2026

LGTM

@tonyqus tonyqus merged commit 7b9deeb into master Mar 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToxyTable.Print improvement

1 participant