Show-ConsoleApp
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>]#All Parameter SetsDescription
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)" }
} -PassThruFilter 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 -PassThruCapture a scripted run without a physical console.
Parameters
- -Capture ScreenCapture
- Memory capture instead of terminal output; also supplies default screen dimensions.
- -Content ScriptBlock
- Layout script emitting stable inputs and widgets. Invoked once on the caller's thread.
- -InputSource IInputSource
- Input source, including ScriptedInput for examples and tests. Uses the existing core input lease.
- -Live LiveSessionOptions
- Optional full-screen live rendering settings, passed directly to the core runner. Inline mode is rejected before input or state initialization.
- -Mode InteractionMode
- Interaction mode override, as in Read-ConsoleText. A running app requires Rich; use -StaticSnapshot without interactive input.
- Possible values:
Rich,Line,Accessible - -NoMouse SwitchParameter
- Disables optional terminal mouse reporting while retaining keyboard operation.
- -PassThru SwitchParameter
- Returns final named values as one ordinary hashtable. Callback output is discarded.
- -Profile TerminalProfile
- Terminal capabilities and dimensions; defaults to the existing interactive profile resolution.
- -StaticSnapshot SwitchParameter
- Prints or captures one initialized snapshot without reading input; usable in CI or redirected output.
- -Theme ITheme
- 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.