Skip to content
ConsoleMonster
Cmdlet

Show-Console

Module
ConsoleMonster
Inputs
System.Management.Automation.PSObject

Shows objects, text and widgets in a readable view that fits the terminal.

Syntax

Show-Console
[-AsWidget]
[-Border <Rounded|Square|Double|Minimal|Rule>]
[-Caption <Object>]
[-CardsBelow <Int32>]
[-Culture <CultureInfo>]
[-Depth <Int32>]
[-ErrorLayout <Compact|Standard|Detailed>]
[-Exclude <String[]>]
[-Expand]
[-FunctionName <String>]
[-GroupBy <Object>]
[-IncludeHelp]
[-IndentationGuides]
[[-InputObject] <PSObject>]
[-Language <String>]
[-LineNumbers]
[-MaxInner <Int32>]
[-MaxItems <Int32>]
[-MaxNodes <Int32>]
[-MaxRows <Int32>]
[-NoHeaderSeparator]
[-NoPager]
[-NoSort]
[-PassThru]
[-Property <Object[]>]
[-ShowEmpty]
[-ShowGroupColumn]
[-ShowTotals]
[-SourceLines <Int32[]>]
[-StatusProperty <String>]
[-Title <Object>]
[-View <String>]
[-Width <Int32>]
[-Wrap]
[<CommonParameters>]
#
Parameter set: Objects
Show-Console
[-AsWidget]
[-Border <Rounded|Square|Double|Minimal|Rule>]
[-Caption <Object>]
[-CardsBelow <Int32>]
[-Culture <CultureInfo>]
[-Depth <Int32>]
[-ErrorLayout <Compact|Standard|Detailed>]
[-Exclude <String[]>]
[-Expand]
[-FunctionName <String>]
[-GroupBy <Object>]
[-IncludeHelp]
[-IndentationGuides]
[-Language <String>]
[-LineNumbers]
[-MaxInner <Int32>]
[-MaxItems <Int32>]
[-MaxNodes <Int32>]
[-MaxRows <Int32>]
[-NoHeaderSeparator]
[-NoPager]
[-NoSort]
[-PassThru]
-Path <String>
[-Property <Object[]>]
[-ShowEmpty]
[-ShowGroupColumn]
[-ShowTotals]
[-SourceLines <Int32[]>]
[-StatusProperty <String>]
[-Title <Object>]
[-View <String>]
[-Width <Int32>]
[-Wrap]
[<CommonParameters>]
#
Parameter set: Path
Show-Console
[-AsWidget]
[-Border <Rounded|Square|Double|Minimal|Rule>]
[-Caption <Object>]
[-CardsBelow <Int32>]
-Content <Object>
[-Culture <CultureInfo>]
[-Depth <Int32>]
[-ErrorLayout <Compact|Standard|Detailed>]
[-Exclude <String[]>]
[-Expand]
[-FunctionName <String>]
[-GroupBy <Object>]
[-IncludeHelp]
[-IndentationGuides]
[-Language <String>]
[-LineNumbers]
[-MaxInner <Int32>]
[-MaxItems <Int32>]
[-MaxNodes <Int32>]
[-MaxRows <Int32>]
[-NoHeaderSeparator]
[-NoPager]
[-NoSort]
[-PassThru]
[-Property <Object[]>]
[-ShowEmpty]
[-ShowGroupColumn]
[-ShowTotals]
[-SourceLines <Int32[]>]
[-StatusProperty <String>]
[-Title <Object>]
[-View <String>]
[-Width <Int32>]
[-Wrap]
[<CommonParameters>]
#
Parameter set: Content

Description

Pipe objects to choose a view automatically, or use View for a table, list, object tree, source code, JSON, error or Markdown. Property chooses fields and Width sets the available space. Use New-ConsoleChart, New-ConsoleRule and New-ConsoleTree to construct those widgets.

Markdown document viewer ------------------------

When Markdown with headings exceeds the screen height and goes directly to a rich terminal, the document viewer opens. It shows an outline and lets you fold sections. Press Ctrl+K to jump to a heading, / or Ctrl+F to search, and q to return to PowerShell.

Markdown pager --------------

Long Markdown without headings uses a scrolling pager in the same terminal conditions. Use Up and Down to scroll, PgUp and PgDn to move a page, and Home or End to jump to either end. Press / or Ctrl+F to search. After closing the search bar, use n and Shift+N to move between matches. Press q to return to PowerShell.

Direct output and widget output -------------------------------

Use NoPager to print Markdown directly. Short Markdown and output routed away from the interactive terminal also use direct output. AsWidget returns the view for composition or export. PassThru returns the original objects on the direct rendering path.

Examples

Example 1

Get-Process | Select-Object -First 5 | Show-Console

Show a few running processes

Example 2

$showConsoleOptions = @{
    View = 'List'
    Property = @('ProcessName', 'Id', 'WorkingSet64')
}
Get-Process | Select-Object -First 3 | Show-Console @showConsoleOptions

Read selected fields as a list

Example 3

$showConsoleOptions = @{
    View = 'Tree'
    Depth = 1
    Property = @('Name', 'FullName', 'LastWriteTime')
}
Get-Item . | Show-Console @showConsoleOptions

Inspect a file object's members with a bounded tree

Example 4

$showConsoleOptions = @{
    LineNumbers = $true
    View = 'Code'
    Language = 'PowerShell'
    Content = {
        'Get-Process | Select-Object -First 5'
    }
}
Show-Console @showConsoleOptions

Show a PowerShell snippet with line numbers

Example 5

Show-Console -Content {
    $panelOptions = @{
        Title = 'Build summary'
        Content = {
            $rowsOptions = @{
                Gap = 1
                Content = {
                    $textOptions = @{
                        Text = @('All checks passed')
                        Role = 'Pass'
                    }
                    New-ConsoleText @textOptions
                    New-ConsoleRule -Title 'Ready to review'
                }
            }
            New-ConsoleRows @rowsOptions
        }
    }
    New-ConsolePanel @panelOptions
}

Compose a panel with native PowerShell script blocks

Example 6

$showConsoleOptions = @{
    AsWidget = $true
    View = 'List'
    Property = @('ProcessName', 'Id')
}
Get-Process | Select-Object -First 3 |
    Show-Console @showConsoleOptions |
    Export-ConsoleFrame -Format Text

Return a plain-text document for another pipeline command

Example 7

$markdown = @(
    '# Plan'
    ''
    1..60 | ForEach-Object { "- Planned check $_" }
    ''
    '# Results'
    ''
    1..60 | ForEach-Object { "- Result $_" }
) -join [Environment]::NewLine
$markdown | Show-Console -View Markdown

Open a Markdown document with two headings. If it exceeds the terminal height, press Ctrl+K to jump to Results, then press q to return to PowerShell. Use NoPager to print the same document directly.

Example 8

Get-ConsoleDemo -Slug 'welcome-compact' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'server-estate' | Select-Object -ExpandProperty Source

Read any of these gallery scripts to see Show-Console in a complete example. Each lookup returns the script's source. Use the same slug with Show-ConsoleDemo to run it.

Parameters

-AsWidget SwitchParameter optional
Returns the constructed widget.
-Border TableBorder optional
Table border style; default Rounded.
Possible values: Rounded, Square, Double, Minimal, Rule
-Caption Object optional
A table caption.
-CardsBelow Int32 optional
Table card breakpoint; default 60 cells.
-Culture CultureInfo optional
The culture used for values.
-Depth Int32 optional
Maximum nesting depth; default three.
-ErrorLayout String optional
Error detail: Compact, Standard or Detailed.
Possible values: Compact, Standard, Detailed
-Exclude String[] optional
Object members omitted without reading their getters.
-Expand SwitchParameter optional
Expands a table to the available width.
-FunctionName String optional
Code view: select the full source lines of one PowerShell function by name without running the script.
-GroupBy Object optional
Groups rows or records by a property or script block.
-IncludeHelp SwitchParameter optional
Include comment-based help immediately before the function selected with FunctionName. Help inside the function is already part of its source.
-IndentationGuides SwitchParameter optional
Show themed scope or indentation guides in a Code view.
-InputObject PSObject optionalposition: 0pipeline: True (ByValue)sets: Objects
The object, widget or text to display.
-Language String optional
Code language; default Auto.
-LineNumbers SwitchParameter optional
Shows code line numbers.
-MaxInner Int32 optional
Maximum inner errors; default four.
-MaxItems Int32 optional
Maximum inspected items per collection; default 100.
-MaxNodes Int32 optional
Maximum hierarchy nodes; default 1000.
-MaxRows Int32 optional
Maximum displayed rows or chart groups; zero shows all.
-NoHeaderSeparator SwitchParameter optional
Underlines headers rather than drawing a separator.
-NoPager SwitchParameter optional
Disables default-on Markdown paging.
-NoSort SwitchParameter optional
Preserves the input order of groups.
-PassThru SwitchParameter optional
Returns the original input after display.
-Property Object[] optional
Property names, patterns or calculated column records.
-ShowEmpty SwitchParameter optional
Keeps empty fields in record views.
-ShowGroupColumn SwitchParameter optional
Keeps the grouped property in table rows.
-ShowTotals SwitchParameter optional
Shows a totals row for numeric columns.
-SourceLines Int32[] optional
Code view: the first and last source line to show, inclusive.
-StatusProperty String optional
The property shown through the status presenter.
-Title Object optional
The view title, including markup.
-View String optional
Auto, Table, List, Tree, Code, Json, Error or Markdown. Tree inspects object members; New-ConsoleTree builds node hierarchies.
Possible values: Auto, Table, List, Tree, Code, Json, Error, Markdown
-Width Int32 optional
Layout width; zero resolves the terminal with a 100-cell fallback.
-Wrap SwitchParameter optional
Wraps long table values or code lines.
-Path String requiredsets: Path
A file for Code, Json or Markdown.
-Content Object requiredsets: Content
A widget, text or script block producing display content.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.