Skip to content
ConsoleMonster
Class

InteractiveOptions

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed
Attributes
Fluent

Settings shared by prompts, menus and forms: how to interact (detected by default), where input comes from, the terminal profile, theme and labels. Every property is optional.

Inheritance

  • object
  • InteractiveOptions

Usage

Explore 141 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 110

Constructors

public InteractiveOptions() #

Methods

public InteractiveOptions Clone() #

Returns a copy.

Returns

InteractiveOptions The copy.
public InteractionMode ResolveMode() #

Picks the interaction mode: snapshot and non-interactive guards apply first; accessible environment/defaults precede a requested rich mode; then non-interactive sessions (the InteractiveOptions.NonInteractive flag, CONSOLEMONSTER_NONINTERACTIVE=1, CI, redirected input without an input source) get InteractionMode.None; CONSOLEMONSTER_ACCESSIBLE=1 gets InteractionMode.Accessible; consoles without VT get InteractionMode.Line; everything else InteractionMode.Rich.

Returns

InteractionMode The mode.

Properties

public static InteractiveOptions Default { get; set; } #

Process-wide defaults used when a prompt gets no options.

public InteractionMode? Mode { get; set; } #

Forces an interaction mode; null detects it (see InteractiveOptions.ResolveMode).

public bool NonInteractive { get; set; } #

Treats the session as non-interactive (PowerShell's -NonInteractive): prompts use defaults or fail.

public bool Mouse { get; set; } #

Whether prompts, menus, pagers and apps take mouse input where the terminal reports it (default true). False, or CONSOLEMONSTER_NOMOUSE=1, leaves the mouse to the terminal (selection, scrollback); every action keeps its key.

public IInputSource? Input { get; set; } #

An input source instead of the console (a script in tests and demos).

public Func<TimeSpan>? ActionClock { get; set; } #
NoFluent

Optional monotonic clock for grid and app action-log timestamps, relative to each action's start. Null uses real elapsed time. Simulations and capture recipes can supply a thread-safe clock such as SimulatedClock.Read; the action worker may sample it from another thread. This does not replace action delays, cancellation, or input pacing.

public TerminalProfile? Profile { get; set; } #

The terminal profile; null uses Terminal.GetCurrentProfile.

public ITheme? Theme { get; set; } #

The theme; null uses Terminal.Theme.

public PromptLabels? Labels { get; set; } #

The built-in words; null uses PromptLabels.Default.

public ILineConsole? LineConsole { get; set; } #

Line input and output for the line-based and accessible modes; null uses the console.

public int? MaxInlineHeight { get; set; } #

The most rows an inline prompt may take (default: the window height minus two, at most 20).

public ScreenCapture? Capture { get; set; } #

Where prompts draw in InteractionMode.Rich mode (tests use a recording surface). Null picks the right one: inline below the cursor, or an overlay over a running live dashboard.

public ITerminalTarget? Target { get; set; } #

Where the prompt runs (see ITerminalTarget), or null for Terminal.Target. A target other than the console supplies the input (null input: nobody can answer, so defaults apply), the profile, and for a RecordingTarget the screen capture. InteractiveOptions.Input, InteractiveOptions.Profile and InteractiveOptions.Capture still win when set.

Extension Methods

public static InteractiveOptions Capture(InteractiveOptions interactiveOptions, ScreenCapture? value) #

Sets InteractiveOptions.Capture: Where prompts draw in InteractionMode.Rich mode (tests use a recording surface). Null picks the right one: inline below the cursor, or an overlay over a running live dashboard.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Interactive.ScreenCapture? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                     // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Capture = value };    interactiveOptions.Capture(value);
public static InteractiveOptions Input(InteractiveOptions interactiveOptions, IInputSource? value) #

Sets InteractiveOptions.Input: An input source instead of the console (a script in tests and demos).

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Input.IInputSource? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                   // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Input = value };    interactiveOptions.Input(value);
Labels 2 overloads
public static InteractiveOptions Labels(InteractiveOptions interactiveOptions, PromptLabels? value) #

Sets InteractiveOptions.Labels: The built-in words; null uses PromptLabels.Default.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Interactive.PromptLabels? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                    // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Labels = value };    interactiveOptions.Labels(value);
public static InteractiveOptions Labels(InteractiveOptions interactiveOptions, Action<PromptLabels> configure) #

Configures InteractiveOptions.Labels in place (creating it when not set): The built-in words; null uses PromptLabels.Default.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
configure System.Action<ConsoleMonster.Interactive.PromptLabels> required
Configures the value.

Returns

InteractiveOptions The same instance.
public static InteractiveOptions LineConsole(InteractiveOptions interactiveOptions, ILineConsole? value) #

Sets InteractiveOptions.LineConsole: Line input and output for the line-based and accessible modes; null uses the console.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Interactive.ILineConsole? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                         // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { LineConsole = value };    interactiveOptions.LineConsole(value);
public static InteractiveOptions MaxInlineHeight(InteractiveOptions interactiveOptions, int? value) #

Sets InteractiveOptions.MaxInlineHeight: The most rows an inline prompt may take (default: the window height minus two, at most 20).

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value int? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                             // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { MaxInlineHeight = value };    interactiveOptions.MaxInlineHeight(value);
public static InteractiveOptions Mode(InteractiveOptions interactiveOptions, InteractionMode? value) #

Sets InteractiveOptions.Mode: Forces an interaction mode; null detects it (see InteractiveOptions.ResolveMode).

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Interactive.InteractionMode? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                  // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Mode = value };    interactiveOptions.Mode(value);
public static InteractiveOptions Mouse(InteractiveOptions interactiveOptions, bool value = true) #

Sets InteractiveOptions.Mouse: Whether prompts, menus, pagers and apps take mouse input where the terminal reports it (default true). False, or CONSOLEMONSTER_NOMOUSE=1, leaves the mouse to the terminal (selection, scrollback); every action keeps its key.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value bool = true optional
The value; true when omitted.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                   // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Mouse = value };    interactiveOptions.Mouse(value);
public static InteractiveOptions NonInteractive(InteractiveOptions interactiveOptions, bool value = true) #

Sets InteractiveOptions.NonInteractive: Treats the session as non-interactive (PowerShell's -NonInteractive): prompts use defaults or fail.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value bool = true optional
The value; true when omitted.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                            // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { NonInteractive = value };    interactiveOptions.NonInteractive(value);
public static InteractiveOptions Profile(InteractiveOptions interactiveOptions, TerminalProfile? value) #

Sets InteractiveOptions.Profile: The terminal profile; null uses Terminal.GetCurrentProfile.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Capabilities.TerminalProfile? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                     // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Profile = value };    interactiveOptions.Profile(value);
public static InteractiveOptions Target(InteractiveOptions interactiveOptions, ITerminalTarget? value) #

Sets InteractiveOptions.Target: Where the prompt runs (see ITerminalTarget), or null for Terminal.Target. A target other than the console supplies the input (null input: nobody can answer, so defaults apply), the profile, and for a RecordingTarget the screen capture. InteractiveOptions.Input, InteractiveOptions.Profile and InteractiveOptions.Capture still win when set.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Output.ITerminalTarget? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                    // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Target = value };    interactiveOptions.Target(value);
public static InteractiveOptions Theme(InteractiveOptions interactiveOptions, ITheme? value) #

Sets InteractiveOptions.Theme: The theme; null uses Terminal.Theme.

Parameters

interactiveOptions ConsoleMonster.Interactive.InteractiveOptions required
The instance.
value ConsoleMonster.Styling.ITheme? required
The value.

Returns

InteractiveOptions The same instance.

Examples

// C# initializer or property                                                   // C# fluent
new global::ConsoleMonster.Interactive.InteractiveOptions { Theme = value };    interactiveOptions.Theme(value);