Skip to content

Add table rendering helper to ConsoleKit - #250

Open
awaisdev5765 wants to merge 2 commits into
vapor:mainfrom
awaisdev5765:add-table-rendering
Open

awaisdev5765 wants to merge 2 commits into
vapor:mainfrom
awaisdev5765:add-table-rendering

Conversation

@awaisdev5765

Copy link
Copy Markdown

Motivation

Adds a table rendering helper to ConsoleKit, tracked in issue #246.

Changes

  • New Console.printTable(_:style:) extension in Output/Console+Table.swift which renders rows as a bordered ASCII table.
  • Column widths auto-size from the longest cell per column.
  • Ragged rows are padded to the column count.
  • Empty input renders nothing.

Testing

  • 5 new tests in Tests/ConsoleKitTests/ConsoleTableTests.swift covering basic rendering, ragged rows, empty input, separator placement, and single-column tables.
  • All existing tests (39 in 5 suites) pass locally with zero regressions.

Adds Console.printTable(_:style:) which renders rows as a bordered
ASCII table with automatic column sizing and a bold header row.

- New extension in Output/Console+Table.swift
- Column widths auto-size from the longest cell per column
- Ragged rows are padded to the column count
- Empty input renders nothing
- 5 new tests covering basic rendering, ragged rows, empty input,
  separator placement, and single-column tables

Issue vapor#246
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.06%. Comparing base (0944ca5) to head (b6d3f06).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
+ Coverage   82.47%   83.06%   +0.58%     
==========================================
  Files          29       30       +1     
  Lines         896      927      +31     
==========================================
+ Hits          739      770      +31     
  Misses        157      157              
Files with missing lines Coverage Δ
Sources/ConsoleKit/Output/Console+Table.swift 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fpseverino fpseverino linked an issue Oct 21, 2026 that may be closed by this pull request
@fpseverino

Copy link
Copy Markdown
Member

Thanks for the PR! Please run swift format --parallel --in-place --recursive . to format your code and run swift format lint --parallel --strict --recursive . to check if it is properly formatted.

Per maintainer request. swift format lint --parallel --strict --recursive . passes.
@awaisdev5765

Copy link
Copy Markdown
Author

Done — ran swift format --parallel --in-place --recursive . and verified with swift format lint --parallel --strict --recursive . (passes). Pushed as b6d3f06.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a table rendering helper to ConsoleKit

3 participants