Skip to content
ConsoleMonster

API Reference

Interface

ITerminalTarget

Namespace ConsoleMonster.Output
Assembly ConsoleMonster
Modifiers abstract

Where console output goes and where input comes from: the capability profile (size, colour depth, glyph tier, culture and language), the theme, the writer and the input source. Every write, live session, prompt and status helper resolves one: an explicit target (LiveSessionOptions, InteractiveOptions, the TerminalTargetExtensions methods) or the ambient Terminal.Target.

Remarks

Built-ins: ConsoleTarget (the process console, the default), RecordingTarget (in memory, for tests; see TestTerminal.Target), WriterTarget (a TextWriter with a chosen tier and width) and NullTarget (discards everything). Implement it to host ConsoleMonster output elsewhere, for example in a log window.

Usage

Explore 22 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.

Returned or exposed by 4

Accepted by parameters 18

Properties

public abstract String Name { get; } #

A short description for diagnostics, for example console or recording 80x24.

public abstract TerminalProfile Profile { get; } #

The capability profile for a write happening now (the console's refreshes its size on every call).

public abstract ITheme? Theme { get; } #

The theme, or null to choose one from the profile (see Terminal.ResolveTheme).

public abstract ITerminalWriter? Writer { get; } #

The writer that receives the output, or null for the process console. The target owns it: callers write and flush but never dispose it.

public abstract IInputSource? Input { get; } #

The input for prompts, menus and forms, or null. On the console null means the keyboard; on any other target it means nobody can answer, so prompts use their defaults or explain what is missing.

Extension Methods

public static RenderContext CreateContext(ITerminalTarget target) #
Returns: RenderContext

A render context for the target's profile and theme (for measuring or rendering by hand).

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.

Returns

The context.

public static Void Status(ITerminalTarget target, String markup, Action<StatusContext> action) #
Returns: Void

Runs work under a status (see Terminal.Status).

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.
markup System.String requiredposition: 1
The first status text.
action System.Action<ConsoleMonster.Output.StatusContext> requiredposition: 2
The work.
public static async Task StatusAsync(ITerminalTarget target, String markup, Func<StatusContext, Task> action) #
Returns: Task

Runs asynchronous work under a status.

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.
markup System.String requiredposition: 1
The first status text.
action System.Func<ConsoleMonster.Output.StatusContext, System.Threading.Tasks.Task> requiredposition: 2
The work.

Returns

A task that completes when the work has finished.

public static Void Write(ITerminalTarget target, IWidget widget) #
Returns: Void

Writes a widget once.

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.
widget ConsoleMonster.Layout.IWidget requiredposition: 1
The widget.
public static Void WriteLines(ITerminalTarget target, IReadOnlyList<StyledLine> lines, Boolean newLine = true) #
Returns: Void

Writes styled lines; with newLine false the last line is left open.

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.
lines System.Collections.Generic.IReadOnlyList<ConsoleMonster.Text.StyledLine> requiredposition: 1
The lines.
newLine System.Boolean = true optionalposition: 2
Whether to end the last line.
public static Void WriteMarkup(ITerminalTarget target, String markup) #
Returns: Void

Writes markup without ending the line.

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.
markup System.String requiredposition: 1
The markup.
public static Void WriteMarkupLine(ITerminalTarget target, String markup) #
Returns: Void

Writes one line of markup.

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.
markup System.String requiredposition: 1
The markup.
public static Void WriteRich(ITerminalTarget target, RichText text, Boolean newLine = true) #
Returns: Void

Writes rich text as lines; with newLine false the last line is left open.

Parameters

target ConsoleMonster.Output.ITerminalTarget requiredposition: 0
The target.
text ConsoleMonster.Text.RichText requiredposition: 1
The rich text.
newLine System.Boolean = true optionalposition: 2
Whether to end the last line.