Table of Contents

Interface IOutputConsole

Namespace
ProjGraph.Lib.Core.Abstractions
Assembly
ProjGraph.Lib.Core.dll

Provides an abstraction for console output to improve testability and decouple from Spectre.Console.

public interface IOutputConsole

Methods

PromptSelectionAsync(string, IEnumerable<string>, CancellationToken)

Displays a selection prompt and returns the user's choice.

Task<string> PromptSelectionAsync(string title, IEnumerable<string> choices, CancellationToken cancellationToken = default)

Parameters

title string

The prompt title.

choices IEnumerable<string>

The available choices.

cancellationToken CancellationToken

A token to monitor for cancellation.

Returns

Task<string>

The selected choice.

RunWithStatusAsync(string, Func<Task>, CancellationToken)

Displays a status spinner while executing an asynchronous action.

Task RunWithStatusAsync(string statusMessage, Func<Task> action, CancellationToken cancellationToken = default)

Parameters

statusMessage string

The status message to display.

action Func<Task>

The action to execute.

cancellationToken CancellationToken

A token to monitor for cancellation.

Returns

Task

Write(string)

Writes a message to the console without a newline.

void Write(string message)

Parameters

message string

The message to write.

WriteError(string)

Writes an error message to the console.

void WriteError(string message)

Parameters

message string

The error message to write.

WriteInfo(string)

Writes an informational message to the console.

void WriteInfo(string message)

Parameters

message string

The informational message to write.

WriteLine(string)

Writes a message to the console followed by a newline.

void WriteLine(string message)

Parameters

message string

The message to write.

WriteMarkup(string)

Writes a message with markup to the console.

void WriteMarkup(string markup)

Parameters

markup string

The markup content to write.

WriteSuccess(string)

Writes a success message to the console.

void WriteSuccess(string message)

Parameters

message string

The success message to write.

WriteWarning(string)

Writes a warning message to the console.

void WriteWarning(string message)

Parameters

message string

The warning message to write.