ConsoleGuiTools
ConsoleGuiTools copied to clipboard
Request: Control over how columns are collapsed/truncated
Example: The two last columns contain long paths that typically only differ at the end.
It would be nice if you could select if columns should be collapsed/truncated from left or right and at a fixed length.
Get-SourceData | Select-Object FactoryNo, LocationName, StagingPath, CentralUpgradeOverrideDir | Out-ConsoleGridUI -passthru -ColumnWidth 3, 20, -20, -30
Reserving 3 and 20 chars for the first and second column, and 20 and 30 chars for the third and fourth column with the - sign indicating that the truncation should be on the left side.
Alternatively, offer a parameter with strings that the display would collapse:
Get-SourceData | Select-Object FactoryNo, LocationName, StagingPath, CentralUpgradeOverrideDir | Out-ConsoleGridUI -passthru -collapse "\\app100213\Staging", "\\tine.no\applikasjon\TINE_WMS"
Note that only the display should collapse/truncate while the actual values should be passed on in their original length.
Best way to have a scrolling in column but it is difficult to implement.
Some other options to consider:
- Eliminate some cruft columns: do you really need 3 columns for the checkbox? It's ok to have a √ character next to an item to indicate it's selected.
- Show ellipses … at the end of a value that has been truncated (or the beginning - I like @LarsFosdal's left-truncation idea). Some terminals may not support the single-character ellipses, and using three dots would probably exacerbate the truncation problem. For these cases a single dot could indicate truncation.
- Choose a different algorithm for determining max column width to eliminate truncation. Check all the visible values' length instead of half of them. It can be visually jarring to have columns resize when you scroll, but it's a simpler implementation than many others.
- Allow horizontal scroll when the width is wider than the visible portal. It's not ideal, but it works like Out-GridView.
- Truncate like Jexer does, with a ~ and the last few letters of the filename.
Note: I considered vertical scrolling when I wrote AsciiMenu.ps1. The scroll thumb algorithm was difficult to write and might be reusable. Feel free to use that code if it suits your purpose.
@andschwa This should be closed as won't fix since it's for the Avalona version.