IAnsiConsole

Represents a console.

Represents a console.

Properties

Cursor : IAnsiConsoleCursor

Gets the console cursor.

ExclusivityMode : IExclusivityMode

Gets the exclusivity mode.

Input : IAnsiConsoleInput

Gets the console input.

Pipeline : RenderPipeline

Gets the render pipeline.

Profile : Profile

Gets the console profile.

Methods

public void Clear(bool home)

Clears the console.

Parameters:

home (bool)
If the cursor should be moved to the home position.
public void Write(IRenderable renderable)

Writes a IRenderable to the console.

Parameters:

renderable (IRenderable)
The IRenderable to write.

Extension Methods

void AlternateScreen(this IAnsiConsole console, Action action)

Switches to an alternate screen buffer if the terminal supports it.

T Ask<T>(this IAnsiConsole console, string prompt)

Displays a prompt to the user.

Returns:

The prompt input result.

T Ask<T>(this IAnsiConsole console, string prompt, CultureInfo culture)

Displays a prompt to the user.

Returns:

The prompt input result.

Task<T> AskAsync<T>(this IAnsiConsole console, string prompt, CancellationToken cancellationToken)

Displays a prompt to the user.

Returns:

The prompt input result.

Task<T> AskAsync<T>(this IAnsiConsole console, string prompt, CultureInfo culture, CancellationToken cancellationToken)

Displays a prompt to the user.

Returns:

The prompt input result.

void Clear(this IAnsiConsole console)

Clears the console.

bool Confirm(this IAnsiConsole console, string prompt, bool defaultValue)

Displays a prompt with two choices, yes or no.

Returns:

true if the user selected "yes", otherwise false.

Task<bool> ConfirmAsync(this IAnsiConsole console, string prompt, bool defaultValue, CancellationToken cancellationToken)

Displays a prompt with two choices, yes or no.

Returns:

true if the user selected "yes", otherwise false.

Recorder CreateRecorder(this IAnsiConsole console)

Creates a recorder for the specified console.

Returns:

A recorder for the specified console.

LiveDisplay Live(this IAnsiConsole console, IRenderable target)

Creates a new LiveDisplay instance for the console.

Returns:

A LiveDisplay instance.

void Markup(this IAnsiConsole console, string value)

Writes the specified markup to the console.

void Markup(this IAnsiConsole console, string format, object[] args)

Writes the specified markup to the console.

void Markup(this IAnsiConsole console, IFormatProvider provider, string format, object[] args)

Writes the specified markup to the console.

void MarkupInterpolated(this IAnsiConsole console, FormattableString value)

Writes the specified markup to the console. All interpolation holes which contain a string are automatically escaped.

void MarkupInterpolated(this IAnsiConsole console, IFormatProvider provider, FormattableString value)

Writes the specified markup to the console. All interpolation holes which contain a string are automatically escaped.

void MarkupLine(this IAnsiConsole console, string value)

Writes the specified markup, followed by the current line terminator, to the console.

void MarkupLine(this IAnsiConsole console, string format, object[] args)

Writes the specified markup, followed by the current line terminator, to the console.

void MarkupLine(this IAnsiConsole console, IFormatProvider provider, string format, object[] args)

Writes the specified markup, followed by the current line terminator, to the console.

void MarkupLineInterpolated(this IAnsiConsole console, FormattableString value)

Writes the specified markup, followed by the current line terminator, to the console. All interpolation holes which contain a string are automatically escaped.

void MarkupLineInterpolated(this IAnsiConsole console, IFormatProvider provider, FormattableString value)

Writes the specified markup, followed by the current line terminator, to the console. All interpolation holes which contain a string are automatically escaped.

Progress Progress(this IAnsiConsole console)

Creates a new Progress instance for the console.

Returns:

A Progress instance.

T Prompt<T>(this IAnsiConsole console, IPrompt<T> prompt)

Displays a prompt to the user.

Returns:

The prompt input result.

Task<T> PromptAsync<T>(this IAnsiConsole console, IPrompt<T> prompt, CancellationToken cancellationToken)

Displays a prompt to the user.

Returns:

The prompt input result.

T RunExclusive<T>(this IAnsiConsole console, Func<T> func)

Runs the specified function in exclusive mode.

Returns:

The result of the function.

Task<T> RunExclusive<T>(this IAnsiConsole console, Func<Task<T>> func)

Runs the specified function in exclusive mode asynchronously.

Returns:

The result of the function.

Status Status(this IAnsiConsole console)

Creates a new Status instance for the console.

Returns:

A Status instance.

string ToAnsi(this IAnsiConsole console, IRenderable renderable)

Gets the VT/ANSI control code sequence for a IRenderable.

Returns:

The VT/ANSI control code sequence.

void Write(this IAnsiConsole console, string text)

Writes the specified string value to the console.

void WriteAnsi(this IAnsiConsole console, string sequence)

Writes a VT/Ansi control code sequence to the console (if supported).

void WriteException(this IAnsiConsole console, Exception exception, ExceptionFormats format)

Writes an exception to the console.

void WriteException(this IAnsiConsole console, Exception exception, ExceptionSettings settings)

Writes an exception to the console.