Skip to content
ConsoleMonster
Cmdlet

Show-ConsoleApp

Module
ConsoleMonster
Inputs
None
Outputs
System.Collections.Hashtable

Runs native input controls and dependent displays in a console application.

Syntax

Show-ConsoleApp
[-Capture <ScreenCapture>]
[-Content] <ScriptBlock>
[-InputSource <IInputSource>]
[-Live <LiveSessionOptions>]
[-Mode <Rich|Line|Accessible>]
[-NoMouse]
[-PassThru]
[-Profile <TerminalProfile>]
[-StaticSnapshot]
[-Theme <ITheme>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Builds the layout once, then runs input synchronously on the caller's PowerShell thread. Callbacks are queued by controls and drained before input reads; dependent builders run on that same thread. Escape exits. Cancellation restores the terminal through the core runner. Use -StaticSnapshot to capture or print initialized values without interactive input. Nothing is sent to the pipeline unless -PassThru requests one ordinary hashtable.

Examples

Example 1

Show-ConsoleApp {
    New-ConsoleTextInput -Name Query -OnChange { param($Value, $State) $State.Edits = 1 + $State.Edits }
    New-ConsoleTable -Bind { $services | Where-Object Name -Like "*$($State.Query)*" } -Property Name, Status
    New-ConsoleBinding { "Edits: $($State.Edits)" }
} -PassThru

Filter application data without leaving PowerShell.

Example 2

# Using the object directly
$capture = [ConsoleMonster.Interactive.ScreenCapture]::new(80, 24)
$keys = [ConsoleMonster.Input.ScriptedInput]::new('"abc" Escape')
Show-ConsoleApp { New-ConsoleTextInput -Name Query } -InputSource $keys -Capture $capture -PassThru

Capture a scripted run without a physical console.

Parameters

-Capture ScreenCapture optional
Memory capture instead of terminal output; also supplies default screen dimensions.
-Content ScriptBlock requiredposition: 0
Layout script emitting stable inputs and widgets. Invoked once on the caller's thread.
-InputSource IInputSource optional
Input source, including ScriptedInput for examples and tests. Uses the existing core input lease.
-Live LiveSessionOptions optional
Optional full-screen live rendering settings, passed directly to the core runner. Inline mode is rejected before input or state initialization.
-Mode InteractionMode optional
Interaction mode override, as in Read-ConsoleText. A running app requires Rich; use -StaticSnapshot without interactive input.
Possible values: Rich, Line, Accessible
-NoMouse SwitchParameter optional
Disables optional terminal mouse reporting while retaining keyboard operation.
-PassThru SwitchParameter optional
Returns final named values as one ordinary hashtable. Callback output is discarded.
-Profile TerminalProfile optional
Terminal capabilities and dimensions; defaults to the existing interactive profile resolution.
-StaticSnapshot SwitchParameter optional
Prints or captures one initialized snapshot without reading input; usable in CI or redirected output.
-Theme ITheme optional
Core theme used to render controls and dependent widgets.

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.