Skip to content

Updates OCGV and SHOT to Terminal.Gui v2#267

Draft
tig wants to merge 62 commits intoPowerShell:mainfrom
tig:terminal_gui_v2
Draft

Updates OCGV and SHOT to Terminal.Gui v2#267
tig wants to merge 62 commits intoPowerShell:mainfrom
tig:terminal_gui_v2

Conversation

@tig
Copy link
Copy Markdown
Collaborator

@tig tig commented Nov 13, 2025

Updates OCGV and SHOT to Terminal.Gui v2

Ports Out-ConsoleGridView and Show-ObjectTree from Terminal.Gui v1 (1.17.1) to Terminal.Gui v2 (2.0.0-beta). Also upgrades from .NET 8 to .NET 10.

Summary of Changes

Core Platform

  • Terminal.Gui v1 → v2: Complete rewrite of the UI layer against the v2 API. The old monolithic ConsoleGui.cs is replaced with focused window classes (OutGridViewWindow, ShowObjectTreeWindow).
  • .NET 8 → .NET 10: Updated global.json, TargetFramework, and all package references.
  • Build & project infrastructure: Added GraphicalTools.sln, Directory.Build.props, Directory.Packages.props, nuget.config, and tools/ for IDE support and dev environment setup.

Out-ConsoleGridView (ocgv)

  • Rewritten UI using Terminal.Gui v2 ListView with custom Header view for column headers.
  • Improved TypeGetter — now uses PowerShell format view definitions (.ps1xml), DefaultDisplayPropertySet, and property fallback in priority order. Properly handles ScriptBlock display entries, column type detection, and primitive types.
  • New GridViewDataSource with separate master/filtered lists and proper mark tracking.
  • Regex-based filtering with real-time filter-as-you-type.
  • Status bar with keyboard shortcuts and version info (in -Verbose/-Debug mode).

Show-ObjectTree (shot)

  • Rewritten UI using Terminal.Gui v2 TreeView<T> with RegexTreeViewTextFilter.
  • Proper recursive object expansion with CachedMemberResult / CachedMemberResultElement for lazy-loaded tree nodes.

Tests

  • Added xUnit test project (Microsoft.PowerShell.ConsoleGuiTools.Tests) with 73 tests covering TypeGetter, DataTableColumn, DataTableRow, GridViewHelpers, Serializers, and OutGridViewWindow integration tests.
  • Added Pester test script (Microsoft.PowerShell.ConsoleGuiTools.Tests.ps1).

Documentation

  • Updated Out-ConsoleGridView.md and Show-ObjectTree.md to reflect current parameter set.
  • Updated README.md architecture section.

User Behavior Changes

New Parameters

Parameter Cmdlet(s) Description
-Driver <string> ocgv, shot Sets the Terminal.Gui driver (ansi, windows, or unix). Defaults to ansi. Replaces -UseNetDriver.
-FullScreen ocgv, shot Runs in full-screen mode using the alternate screen buffer. By default, the app now renders inline (no alternate screen buffer).

Removed Parameters

Parameter Cmdlet(s) Notes
-UseNetDriver ocgv, shot Replaced by -Driver. Use -Driver windows for equivalent behavior.
-PassThru ocgv Was already removed in a prior release; doc references cleaned up. Use -OutputMode Multiple (the default).

Changed Behavior

  • Inline rendering by default — The app no longer takes over the full terminal with the alternate screen buffer. It renders inline in the current console. Use -FullScreen to get the old full-screen behavior.
  • Improved column detectionOut-ConsoleGridView now respects PowerShell format view definitions (.ps1xml files) for column headers and formatting. Objects like those from Get-NetAdapter now display the same columns as Format-Table.
  • Regex filtering — The filter box now uses regular expressions instead of simple string matching.
  • MinUI refinement-MinUI now hides the title bar and status bar, but still shows the filter box if -Filter was specified on the command line.

Removed Cmdlet

  • Out-ConsoleTableView (octv) — The prototype TableView-based cmdlet has been removed. Use Out-ConsoleGridView instead.

Fixes

tig added 2 commits November 12, 2025 17:42
WIP: Builds but doesn't run
Refactored `ConsoleGui.cs` to improve modularity, readability, and maintainability. Added dynamic layout handling, improved filtering logic, and enhanced status bar functionality. Simplified data loading and display string updates.

Updated `GridViewHelpers.cs` to handle nullable column widths and improve robustness.

Replaced `Terminal.Gui` package reference with a local project reference in `Microsoft.PowerShell.ConsoleGuiTools.csproj` to facilitate debugging. Added `<CopyLocalLockFileAssemblies>` for better build handling.

Added new launch profiles in `launchSettings.json` for streamlined debugging with preloaded `Out-ConsoleGridView` module.

Upgraded Visual Studio version in `GraphicalTools.sln` to 18.3.11206.111.
@tig
Copy link
Copy Markdown
Collaborator Author

tig commented Nov 13, 2025

Working.... -ish:

image

tig added 4 commits November 13, 2025 17:38
Enhanced the filtering functionality by introducing `_filterErrorView` to display filter-related errors and updated the `ApplyFilter` method to handle `RegexParseException` gracefully. Adjusted `_header` positioning dynamically based on `_filterErrorView` and ensured `ListView` selection defaults to the first item if none is selected.

Refactored `ListViewSource_MarkChanged` to handle null `_inputSource` safely. Simplified `StatusBar` creation and improved `filterErrorView` behavior with `Dim.Auto` for dynamic height and error-specific styling.

Updated `launchSettings.json` with new configurations (`OCGV -Filter`, `OCGV`, `OCGV -MinUi`) for better debugging flexibility. Cleaned up redundant code, improved null safety, and adjusted `Window` dimensions for `MinUI` mode.
Refactored `OnWinSubViewLayout` to add null checks for `_header`
to ensure safety and prevent runtime exceptions. Simplified
"Select All" and "Select None" logic by replacing manual
iteration with `_listView?.MarkAll` calls and added comments
to address a `Terminal.Gui` bug requiring explicit redraws.

Removed default `Ctrl-A` keybinding from `_listView` to allow
custom handling in the status bar. Updated `LangVersion` in
`Microsoft.PowerShell.ConsoleGuiTools.csproj` to `preview` to
enable preview language features. Fixed formatting in the
`ProjectReference` element for consistency.
Add SOT launch config and update Esc shortcut description

Added a new "SOT" launch configuration in `launchSettings.json`
to run the `Show-ObjectTree` command using PowerShell 7-preview.

Updated the "Esc" key shortcut description in `ShowObjectView.cs`
from `"~ESC~ Close"` to `"Close"` for improved clarity.
@tig tig changed the title Updates OCGV to Terminal.Gui v2 Updates OCGV and SOT to Terminal.Gui v2 Nov 14, 2025
tig added 11 commits November 14, 2025 10:00
Refactored `ConsoleGui` and `ShowObjectView` classes to improve readability, maintainability, and adherence to modern C# conventions. Key changes include:

- Updated `FILTER_LABEL` to `_Filter` for UI consistency.
- Simplified `ConsoleGui` initialization logic and removed redundant `SetNeedsDraw` call.
- Rewrote `ShowObjectView` to use nullable fields, modern syntax, and dynamic regex validation.
- Refactored `GetChildren` to handle nested objects with a `while` loop.
- Improved `CachedMemberResult` and `CachedMemberResultElement` with better encapsulation and naming conventions.
- Enhanced `RegexTreeViewTextFilter` with a primary constructor and better regex error handling.
- Simplified `Run` method in `ShowObjectView` for cleaner application lifecycle management.
- Fixed typos in comments and replaced redundant comments with concise explanations.
- General cleanup using modern C# features like expression-bodied methods, pattern matching, and `null`-coalescing operators.
Refactored namespaces to align with `Microsoft.PowerShell` conventions, replacing `OutGridView.Cmdlet` and `OutGridView.Models`. Updated the module version to `0.9.0` to reflect significant changes.

Improved code readability and maintainability by adding XML documentation, enforcing consistent naming conventions, and removing redundant code. Enhanced null safety with nullable annotations and null checks.

Refactored key classes (`ConsoleGui`, `GridViewDataSource`, `GridViewDetails`, `GridViewHelpers`, `OutConsoleGridviewCmdletCommand`, `ShowObjectTreeCmdletCommand`, etc.) to simplify logic, improve error handling, and ensure modern C# practices.

Updated `launchSettings.json` to rename the `SOT` profile to `SHOT` for consistency with the `Show-ObjectTree` cmdlet. Enhanced serialization logic in `Serializers.cs` and improved type handling in `TypeGetter.cs`.

These changes improve the maintainability, safety, and usability of the module while aligning with modern development standards.
Refactored the `ConsoleGui` class into a new class named `OutConsoleGridView` to improve modularity and maintainability. The `ConsoleGui` class was removed, and its functionality was moved to `OutConsoleGridView`, which is now implemented in a separate file (`OutConsoleGridView.cs`).

Updated all references to `ConsoleGui` in `OutConsoleGridViewCmdletCommand`:
- Replaced `_consoleGui` with `_outConsoleGridView`.
- Updated method calls to use `OutConsoleGridView` methods.
- Updated the `Dispose` method to dispose of `_outConsoleGridView`.

This change reorganizes the codebase for better readability and separation of concerns without introducing any functional changes.
The `Cmdlet` attribute for the `OutConsoleGridViewCmdletCommand` class
was updated to rename the cmdlet from `Out-ConsoleGridView` to
`ConsoleGridView`. This change simplifies the cmdlet name and may align
with a new naming convention.

The alias `[Alias("ocgv")]` remains unchanged, ensuring backward
compatibility for users familiar with the shorthand.
… unit testing.

Refactored `OutConsoleGridView` and `ShowObjectTree` for improved maintainability and performance:
- Introduced `OutGridViewWindow` and `ShowObjectTreeWindow` to encapsulate UI logic.
- Added `CachedMemberResult` and `CachedMemberResultElement` for better object hierarchy handling.
- Implemented `RegexTreeViewTextFilter` for regex-based filtering in tree views.

Enhanced data handling and UI:
- Replaced `DataTable` with direct `PSObjects` handling in `ApplicationData`.
- Improved grid view filtering, column width calculations, and status bar shortcuts.
- Enhanced tree view to display object hierarchies with filtering and status bar updates.

Refactored `TypeGetter`:
- Added caching for `FormatViewDefinition` lookups.
- Made `CastObjectsToTableView` static for reusability.

Updated dependencies and removed legacy code:
- Updated `Directory.Packages.props` to use `System.Management.Automation`.
- Removed redundant and outdated code from `OutConsoleGridView`.

Bug fixes and documentation:
- Fixed column width calculation issues and concurrency in `TypeGetter`.
- Improved error handling for invalid regex patterns.
- Added XML documentation for all new and modified classes.
Added a null check in `GetFormatViewDefinitionForObject` to handle cases where `typeName` is null, returning early if necessary. Introduced a caching mechanism using `_formatCache.TryGetValue` to improve performance by reusing cached format view definitions.

Refactored object-to-data-table conversion code for better readability by reformatting inline initializations of `DecimalValue` and `StringValue`.

Improved clarity in data type assignment logic by wrapping nested loops in braces and adopting modern C# syntax (`is not`) for type checks.
Updated `GetFormatViewDefinitionForType` to create a runspace with the default initial session state, ensuring proper loading of format data. Removed redundant fallback logic for `Get-FormatData` invocation. Added `Debug.Assert` to validate non-null results. Updated comments to reflect the new behavior. Included `System.Diagnostics` for debugging utilities.
Enhanced object formatting and display logic in the `Out-ConsoleGridView` cmdlet:
- Added `GetFormatDataForObjects` to retrieve format data for PowerShell objects.
- Updated `EndProcessing` to include format data in `ApplicationData`.
- Improved `DataTable` construction to use format data and added dynamic column formatting.
- Introduced `IsIdentifierProperty` to handle identifier-specific formatting.
- Added `FormatString` and `FormatValue` to `DataTableColumn` for flexible value formatting.
- Enhanced `IValue` interface with `OriginalValue` for raw data access.

Refactored `TypeGetter` to simplify format data retrieval and object-to-table conversion. Updated `launchSettings.json` to include new profiles and simplify commands.

Performed general code cleanup, removed legacy methods, and improved documentation for better maintainability.
Refactored `Render` method in `GridViewDataSource` to improve alignment handling. Enhanced column width management in `OutGridViewWindow` by introducing natural width calculations, truncation safeguards, and scrollbar support. Simplified layout handling with dynamic content size adjustments.

Removed deprecated `GetFormatDataForObjects` method and `FormatData` property, transitioning to dynamic column definitions using `TypeGetter`. Improved type handling with caching, ANSI escape sequence stripping, and better fallback logic for primitive types.

Updated launch configurations for testing new scenarios. Performed general code cleanup, improving readability, maintainability, and error handling.
Refactored the AddHeaders method to be an inline local function
within AddListView, improving modularity and encapsulation.
Removed the original AddHeaders implementation and its call
from the constructor. The new AddHeaders method is conditionally
invoked when _applicationData.MinUI is false.

Updated the Y positioning of _listView to use _filterErrorView
instead of _filterLabel. Adjusted _listView padding and scrollbar
position to integrate the header. Changed MARGIN_LEFT constant
from 1 to 0 to refine UI layout.
Add AllProperties toggle to Out-ConsoleGridView cmdlet

Introduced a new `AllProperties` parameter to the `Out-ConsoleGridView` cmdlet, allowing users to display all object properties instead of default display properties.

Key changes:
- Added `AllProperties` as a `SwitchParameter` in `OutConsoleGridViewCmdletCommand`.
- Updated `ApplicationData` to store the `AllProperties` state.
- Enhanced `OutGridViewWindow` with a `CheckBox` for toggling `AllProperties` and dynamic updates to the grid view and status bar.
- Added `ReloadDataWithAllProperties` and `UpdateStatusBar` methods to handle UI updates.
- Modified `TypeGetter` to support `AllProperties`, prioritizing format view definitions, default display property sets, and fallback to all properties.
- Updated `CastObjectsToTableView` to include an `allProperties` parameter.
- Improved compatibility with CIM instances by using the current runspace for format data retrieval.

These changes enhance the cmdlet's flexibility and usability, particularly for inspecting all object properties.
@tig tig changed the title Updates OCGV and SOT to Terminal.Gui v2 Updates OCGV and SHOT to Terminal.Gui v2 Nov 15, 2025
tig added 6 commits November 15, 2025 14:20
Refactored `OutConsoleGridViewCmdletCommand` and `OutGridViewWindow` classes for improved readability, maintainability, and performance. Introduced a new `Header` class for dynamic grid column headers with bold and underlined styles. Simplified logic, removed redundant methods, and optimized nullability handling.

Enhanced `TypeGetter` to filter out expensive `PS*` metadata properties, improving performance. Updated `ApplicationData` to clarify `AllProperties` behavior and removed unused imports.

Added a new launch configuration in `launchSettings.json` for testing the `-AllProperties` parameter. Improved status bar shortcuts and event handling for better user experience. Updated comments and documentation for consistency.
Updated the assignment of `dataTableColumns` to explicitly convert the result of `typeGetter.GetDataColumnsForObject` into a `List<DataTableColumn>` using `.ToList()`. This change ensures compatibility and enables list-specific operations, improving code clarity and robustness.
- Bump TargetFramework to net10.0 and update SDK to 10.0.101
- Switch NuGet source to nuget.org; comment out PowerShell feed
- Replace UseNetDriver with ForceDriver for driver selection
- Refactor app startup for Terminal.Gui 2.0 (IApplication, driver API)
- Update UI code for Terminal.Gui 2.0: focus, events, property names
- Add support for specifying driver (ansi, windows, unix) via cmdlet
- Modernize code with C# 12 features and improve nullability
- Standardize help text to "TUI" and clean up comments
- Update package references and launch settings for debugging
@Tweekism
Copy link
Copy Markdown

Hey mate, how are you building this at the moment? Using the Invoke-Build as per the main docs seems to build ok but I get this error trying to load the module.

Import-Module: Could not load file or assembly 'System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

@tig
Copy link
Copy Markdown
Collaborator Author

tig commented Feb 13, 2026

I'm just using VS 2026. All the imvoke-build stuff got me confused, so I just ignored it as I'm developing. Happy for guidance.

@BDisp
Copy link
Copy Markdown

BDisp commented Feb 13, 2026

Probably is because PowerShell is targeting "version": "10.0.102" and the PR is targeting "version": "10.0.101".

tig added 2 commits May 1, 2026 09:11
Added ConfigurationManager.AppName assignment to "Out-ConsoleTableView" at the start of StartUi to ensure correct application context before enabling configuration and initializing the window.
Add layout state fields and adjust height logic to switch from Dim.Fill to Dim.Auto in inline mode, ensuring the table view does not occupy the full screen and adapts to content and available space.
@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

With the latest commit you can name the file ~/.tui/Out-ConsoleTableView.config.json and non-FullScreen works:

WindowsTerminal_xabgGD7lZK

@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

With the latest commit you can name the file ~/.tui/Out-ConsoleTableView.config.json and non-FullScreen works:

Sweet! I'll take a look at that shortly.

Meanwhile, here are the results of my tests.

My methodology is:-

  • Launch a pwsh instance
  • Take my user cache file stored as json on disk and convert back into a powershell object.
  • Open a TableView / GridView and immedately close it and time the result (Note: Out-AbortableWhateverView is just a wrapper around your normal Out-ConsoleWhateverView that lets me queue an Esc key

Here is the code for my test functions

#-------------------------------
# Test section

function TestTableView () {
    $cacheFile = join-path ([System.IO.Path]::GetTempPath()) 'Stu.MsGraph_user-cache.tmp'

    $cache = Get-Content $cacheFile -ErrorAction Stop | ConvertFrom-Json -AsHashtable
    # Get list of users, without all the cache timer information
    $cache = $cache["users"] | Select-Object UserPrincipalName, DisplayName
    Out-AbortableTableView -Values $cache -Title "Test"
}
Export-ModuleMember -Function TestTableView

function TestGridView () {
    $cacheFile = join-path ([System.IO.Path]::GetTempPath()) 'Stu.MsGraph_user-cache.tmp'

    $cache = Get-Content $cacheFile -ErrorAction Stop | ConvertFrom-Json -AsHashtable
    # Get list of users, without all the cache timer information
    $cache = $cache["users"] | Select-Object UserPrincipalName, DisplayName
    Out-AbortableGridView -Values $cache -Title "Test"
}
Export-ModuleMember -Function TestGridView

And here is the time results. Don't take to much notice of the absolute value, as it includes the time to start a powerwshell instance and load my profile etc. However it is still useful to compare GridView and TableView to eachother

TableView = 4.094s
GridView = 2.438s

GridView is noticeably faster

image

I also notice that while TableView loads, I see the first row appear, and then it pauses and then all the remaining rows appear at once.

Fixes PowerShell#127

Add Focus and Search options to Out-ConsoleTableView

Introduce Focus and Search parameters to control initial UI focus and cursor positioning. Update ApplicationData and OutTableViewWindow to support these features. Improve key bindings and add FocusTarget enum for focus selection.
@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

Pulled latest commits

Can confirm both inline (non-fullscreen) TableView and colour theming working 👍

image

@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

Latest commit has OCTV working like the below...

Until we understand the perf issues @Tweekism shows, I'm leaving it as OCTV and not replacing OCGV with it.

However, that is my dream...

Note, esp the new -Search and -Focus parameters. They address

But only in OCTV...


external help file: ConsoleGuiToolsModule.dll-Help.xml
keywords: powershell,cmdlet
locale: en-us
Module Name: Microsoft.PowerShell.ConsoleGuiTools
ms.date: 05/01/2026
schema: 2.0.0
title: Out-ConsoleTableView

Out-ConsoleTableView

SYNOPSIS

Sends output to an interactive table view with column headers, horizontal scrolling, and native multi-selection.

SYNTAX

 Out-ConsoleTableView [-InputObject <psobject>] [-Title <string>] [-OutputMode {None | Single |
    Multiple}] [-Filter <string>] [-Search <string>] [-Focus {Table | Filter}] [-MinUI]
    [-FullScreen] [-ForceDriver <string>] [<CommonParameters>]

DESCRIPTION

The Out-ConsoleTableView cmdlet sends the output from a command to a table view window where the output is displayed in an interactive table with column headers, column sizing, and horizontal scrolling.

Use the Filter box at the top of the window to search the text in the table using regular expressions. Unlike the Filter, the -Search parameter positions the cursor on the first matching row without hiding non-matching rows.

Objects are streamed into the table as they arrive from the pipeline — the UI appears immediately and rows are added incrementally.

To send items from the interactive window down the pipeline, select rows (use arrow keys and SPACE or click with the mouse) and press ENTER. Press ESC to cancel without output. Use Ctrl+A to select all rows.

EXAMPLES

Example 1: Output processes to a table view

Get-Process | Out-ConsoleTableView

This command gets the processes running on the local computer and sends them to a table view window with column headers for each property.

Example 2: Select a single process using the table view

Get-Process | octv -OutputMode Single | Stop-Process

This command displays processes in a table view restricted to single selection. The selected process is piped to Stop-Process.

Example 3: Filter processes by name on the command line

Get-Process | octv -Filter "chrome"

This command pre-populates the filter box with "chrome", showing only processes whose properties match that regex pattern.

Example 4: Search for a row without filtering

Get-Service | octv -Search "wuauserv"

This command displays all services but positions the cursor on the first row matching "wuauserv". Unlike -Filter, all rows remain visible.

Example 5: Start with focus on the filter field

Get-ChildItem | octv -Focus Filter

This command opens the table view with the cursor in the filter text field, ready to type a filter immediately. Pressing ENTER while in the filter field accepts the currently selected item(s).

Example 6: Full screen mode with a custom title

Get-Process | octv -FullScreen -Title "Process Monitor"

This command runs the table view in full-screen mode using the alternate screen buffer, with a custom window title.

Example 7: Minimal UI for scripting

Get-Process | octv -MinUI -OutputMode Single

This command shows the table view with no window frame, filter box, or status bar — just the table. Useful for quick selection in scripts.

Example 8: Combine Filter and Search

Get-Process | octv -Filter "svc" -Search "host"

This filters to rows matching "svc" and then positions the cursor on the first of those rows matching "host".

PARAMETERS

-Filter

Pre-populates the Filter edit box, hiding rows that do not match the regular expression pattern.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Search

Positions the cursor on the first row matching this regular expression pattern. Unlike -Filter, non-matching rows remain visible.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Focus

Specifies which UI element receives initial focus.

  • Table (default): The table view receives focus. Use arrow keys to navigate immediately.
  • Filter: The filter text field receives focus. Start typing to filter. Press ENTER to accept the selected item(s).
Type: FocusTarget
Parameter Sets: (All)
Aliases:
Accepted values: Table, Filter

Required: False
Position: Named
Default value: Table
Accept pipeline input: False
Accept wildcard characters: False

-InputObject

Specifies that the cmdlet accepts input for Out-ConsoleTableView.

When you use the InputObject parameter to send a collection of objects to Out-ConsoleTableView, Out-ConsoleTableView treats the collection as one collection object, and it displays one row that represents the collection.

To display each object in the collection, use a pipeline operator (|) to send objects to Out-ConsoleTableView.

Type: PSObject
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-OutputMode

Specifies the items that the interactive window sends down the pipeline as input to other commands.
By default, this cmdlet generates zero, one, or many items.

To send items from the interactive window down the pipeline, select items and press ENTER. ESC cancels.

The values of this parameter determine how many items you can send down the pipeline.

  • None. No items.
  • Single. Zero items or one item. Use this value when the next command can take only one input object.
  • Multiple. Zero, one, or many items. Use this value when the next command can take multiple input objects. This is the default value.
Type: OutputModeOption
Parameter Sets: OutputMode
Aliases:
Accepted values: None, Single, Multiple

Required: False
Position: Named
Default value: Multiple
Accept pipeline input: False
Accept wildcard characters: False

-Title

Specifies the text that appears in the title bar of the Out-ConsoleTableView window.

By default, the title bar displays "Out-ConsoleTableView".

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Out-ConsoleTableView
Accept pipeline input: False
Accept wildcard characters: False

-MinUI

If specified, no window frame, filter box, or status bar will be displayed. The table is shown without chrome.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FullScreen

If specified, the application runs in full-screen mode using the alternate screen buffer. By default, the application renders inline in the current terminal.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ForceDriver

Forces the Terminal.Gui driver to use. Valid values are ansi, windows, or unix.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Management.Automation.PSObject

You can send any object to this cmdlet. Objects are streamed — the UI appears as soon as the first object arrives.

OUTPUTS

System.Object

By default Out-ConsoleTableView returns objects representing the selected rows to the pipeline. Use -OutputMode to change this behavior.

NOTES

  • Out-ConsoleTableView uses Terminal.Gui's TableView control which provides column headers, column sizing, horizontal scrolling, and native multi-row selection.

  • The alias for Out-ConsoleTableView is octv.

  • Objects are streamed into the table as they arrive from the pipeline. The UI appears immediately on the first object and rows are added incrementally. A spinner in the status bar indicates loading is in progress.

  • The command output that you send to Out-ConsoleTableView should not be formatted, such as by using the Format-Table or Format-Wide cmdlets. To select properties, use the Select-Object cmdlet.

  • Keyboard shortcuts:

    • ENTER — Accept selection and close
    • ESC — Cancel and close
    • Ctrl+A — Select all rows (when OutputMode is Multiple)
    • Home/End — Jump to first/last row
    • Arrow keys — Navigate rows and columns
    • Tab — Move focus between filter and table

RELATED LINKS

Out-ConsoleGridView

@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

@tig

I noticed the new MinUI doesn't display the -Title param.

v2
Screenshot From 2026-05-02 02-11-47

v1
image

- Coalesce Application.Invoke() calls: only one UI notification
  in-flight at a time, batching all rows added between dispatches
- Skip data source copy when no filter is active (OnDataChanged
  points table directly at master source)
- Filter(") returns this instead of copying all rows
- Compile regex once per filter operation instead of per-cell
- Cache ColumnNames array at construction time

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

@Tweekism try your perf test on the latest commit please.

@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

Yay, they are now within a fraction of a second of one another.

TV = 2.825s
GV = 2.588s

image

@andyleejordan
Copy link
Copy Markdown
Member

CI is passing 🥳

Refined OutTableViewWindow to set border thickness instead of disabling border style for MinUI mode, and adjusted TableView Y position to start at 0.
@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

@tig

I noticed the new MinUI doesn't display the -Title param.

v2 Screenshot From 2026-05-02 02-11-47

v1 image

Fixed in the latest (for OCTV). UI will be slightly different that the old OCGV. In Single mode, there's no radio buttons. And the MinUi title has a minimal border.

image

Title is now set directly from the Title variable, allowing it to be null if not specified, instead of defaulting to "Out-ConsoleTableView".
@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

And now, if -Title is not provided but -MinUI is, NO title shows.

image

@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

So is the current plan to keep both the OCGV and OCTV around?

@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

So is the current plan to keep both the OCGV and OCTV around?

No. I can't see any reason for the ListView based approach to continue to exist (as long as the perf issues you identified are fixed).

Once you confirm perf is good, my plan is to nuke the old OCGV and rename OCTV to OCGV.

@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

Fixed in the latest (for OCTV). UI will be slightly different that the old OCGV. In Single mode, there's no radio buttons. And the MinUi title has a minimal border.

Yeah that's fine!

I also noticed this "String" word at the top. I'm guessing that is because the new MinUI has column headers when the old one did not.

image

This has reminded me that we are using OCGV -MinUI as a basic quick and dirty menu system. Which, uuuhhh... might not be the intended use case... 😅

Eg:-
image

@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

So is the current plan to keep both the OCGV and OCTV around?

No. I can't see any reason for the ListView based approach to continue to exist (as long as the perf issues you identified are fixed).

Once you confirm perf is good, my plan is to nuke the old OCGV and rename OCTV to OCGV.

Yeah so as per above, it is now within about 200ms of each other

EDIT: its about 5 posts up, you might have missed it.

- Click column header to sort ascending, click again to toggle descending
- Sort glyph (▲/▼) appended to sorted column header name
- Numeric-aware sorting (numbers sort by value, not lexicographically)
- Sorting composes with filter (filter applied first, then sort)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

Sorting now works.

WindowsTerminal_xzUcIhsY7e

There's no keyboard UI for this (yet).

@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

This has reminded me that we are using OCGV -MinUI as a basic quick and dirty menu system. Which, uuuhhh... might not be the intended use case... 😅

Pro-tip: It's now trivial with TG to build apps that just pop any View. E.g. you could prompt an OptionSelector with those options. See

https://gui-cs.github.io/Terminal.Gui/docs/prompt.html

…iewWindow

OutTableViewDataSourceTests (27 tests):
- Construction, ColumnNames, indexer bounds checking
- AddRow including concurrent thread-safety test
- GetOriginalObjectIndex tracking
- Filter: empty/null returns self, regex matching, case-insensitive,
  cross-column, preserves original index, invalid regex throws
- Sort: ascending/descending, numeric-aware, preserves index,
  glyph indicators, invalid index returns self, no mutation of original

OutTableViewWindowIntegrationTests (22 tests):
- Rendering: headers, data, filter, MinUI
- ESC/close behavior
- Accept/selection: cursor row, multi-select, single mode, Ctrl+A
- Filter interaction: typing filters, Enter accepts from filter
- Focus: Table vs Filter targets
- Search: positions cursor, regex, no-match stays at top
- Streaming: OnDataChanged updates display, OnPipelineComplete
- Navigation: Home/End keys

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

That has been on my To-Do list to have a look at, but I've been lazy and/or busy lol.

I also had a look at the Phyton Textual library 😋, but ugh Python... There is a MsGraph module for it, but Powershell is just so convenient for working with Microsoft Cloud services. And I don't really want to start all over again.

@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

This has reminded me that we are using OCGV -MinUI as a basic quick and dirty menu system. Which, uuuhhh... might not be the intended use case... 😅

Pro-tip: It's now trivial with TG to build apps that just pop any View. E.g. you could prompt an OptionSelector with those options. See

https://gui-cs.github.io/Terminal.Gui/docs/prompt.html

In fact, I actually built a sample app that does exactly what you want (./Examples/InlineSelect):

WindowsTerminal_nTbPubsjtV

@Tweekism
Copy link
Copy Markdown

Tweekism commented May 1, 2026

Ok sick! I'll have a look.

@andyleejordan
Copy link
Copy Markdown
Member

@tig let me know when to merge!

@tig tig marked this pull request as draft May 1, 2026 23:31
@tig
Copy link
Copy Markdown
Collaborator Author

tig commented May 1, 2026

@tig let me know when to merge!

Will do. Moved back to Draft for now.

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