New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CustomTableHeaderLabel formatting to differentiate table header labels that are not property names
#17346
Conversation
src/System.Management.Automation/FormatAndOutput/common/PSStyle.cs
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
CustomTableHeaderLabel formatting to differentiate table header labels that are not property names
CustomTableHeaderLabel formatting to differentiate table header labels that are not property namesCustomTableHeaderLabel formatting to differentiate table header labels that are not property names
src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs
Outdated
Show resolved
Hide resolved
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
208904e
to
e15cee8
Compare
…ltiple lines and fix tests
…ViewGenerator_Table.cs Co-authored-by: Ilya <darpa@yandex.ru>
e15cee8
to
012a4f7
Compare
|
Made a change based on @JamesWTruher feedback where the style includes a background color. So the change keeps the whitespace separation between columns. I would not expect most users to set a background color or use inverse, but it keeps the column separation now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide example screenshots before and after change
src/System.Management.Automation/FormatAndOutput/common/FormattingObjects.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment to block merging the PR for now.
Will update once finish reviewing the rest. [Update] No more comments.
src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs
Outdated
Show resolved
Hide resolved
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM

PR Summary
Add
$PSStyle.Formatting.CustomTableHeaderLabelto enable differentiation inFormat-Tableoutput where a table header label isn't an actual property name. Usually these are either abbreviated, calculated, or has units added. Users can get confused because they expect it to be a property name and can't use dot-notation to access it. The default format is the same color as the table header but use italics.Since decoration is absolute and not relative (additive), to make this work correctly for each table header which IS a property member we need to wrap it with the normal decoration. This results in extra characters being emitted.
PR Context
Brought up in https://twitter.com/JustinWGrote/status/1524882725781377024
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.PSCustomTableHeaderLabelDecoration(which runs in a different PS Host).