[terminal] Improve TerminalTable and PrintUtilities: color options, row separators, printToTerminal()#5787
Open
iclanton wants to merge 8 commits intomicrosoft:mainfrom
Open
[terminal] Improve TerminalTable and PrintUtilities: color options, row separators, printToTerminal()#5787iclanton wants to merge 8 commits intomicrosoft:mainfrom
iclanton wants to merge 8 commits intomicrosoft:mainfrom
Conversation
…orizontal lines on fill char - Render horizontal separators between data rows (same chars as the header/body separator), matching the visual convention of bordered tables - Fix renderSeparator to return undefined when fillChar is empty, preventing malformed lines like ├┼┤ when only corner/junction chars are set - Add test cases for >2 columns, single row, header-only, and empty fillChar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ze test snapshots - Add borderColor option: a styling function applied to all border/gridline characters (horizontal separator lines colored as a whole, vertical chars pre-colorized once before rendering) - Add headingColor option: a styling function applied to header cell text only - Refactor getLines() to pre-compute separator lines and styled vertical chars so rendering functions contain no color logic - Add expectSnapshot() helper in tests using AnsiEscape.formatForTests so snapshot files show readable tokens like [cyan]/[bold] instead of raw escapes - Add tests for borderColor, headingColor, and their combination Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ssageInBox - Add IPrintMessageInBoxOptions with borderColor and messageColor styling functions, matching the pattern used by TerminalTable - Add tests for both options and their combination, including the banner (wide-content) fallback layout - Fix validateOutput to measure visual width via AnsiEscape.removeCodes so ANSI escape codes don't inflate the length check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…verload references - Export IPrintMessageInBoxOptions from the package entry point - Add JSDoc for the boxWidth option - Fix @example snippets to use the new 3-arg signature - Use {@Label WITH_OPTIONS} and (printMessageInBox:1) selector to unambiguously reference the primary overload - Update tests to use the options-based API Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds several improvements to
@rushstack/terminal:TerminalTable: Fixes a bug where horizontal separator lines were rendered even when their fill character was set to''. Adds row separators between data rows. AddsborderColorandheadingColorstyling options. Adds aprintToTerminal(terminal)convenience method.PrintUtilities.printMessageInBox: AddsborderColorandmessageColorstyling options via a newIPrintMessageInBoxOptionsinterface, which is now exported from the package. The previousboxWidthpositional parameter is preserved as a deprecated overload; callers should migrate to passingboxWidthvia the options object.Details
The
borderColorandheadingColoroptions onTerminalTableaccept a(text: string) => stringfunction (e.g.Colorize.cyan). Border separator lines are pre-colorized once rather than applying color on every cell render, so the color escape sequence wraps the entire line.The deprecated
printMessageInBox(message, terminal, boxWidth?)overload is preserved for backwards compatibility. The new primary overload isprintMessageInBox(message, terminal, options?). TSDoc{@label}and numeric overload selectors are used so the@deprecatednotice links unambiguously to the new overload.How it was tested
Unit tests were added for all new features and the bug fix, using Jest snapshots normalized via
AnsiEscape.formatForTestsso that ANSI color codes appear as readable tokens (e.g.[cyan]...[default]).