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
titlestringThe prompt title.
choicesIEnumerable<string>The available choices.
cancellationTokenCancellationTokenA token to monitor for cancellation.
Returns
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
statusMessagestringThe status message to display.
actionFunc<Task>The action to execute.
cancellationTokenCancellationTokenA token to monitor for cancellation.
Returns
Write(string)
Writes a message to the console without a newline.
void Write(string message)
Parameters
messagestringThe message to write.
WriteError(string)
Writes an error message to the console.
void WriteError(string message)
Parameters
messagestringThe error message to write.
WriteInfo(string)
Writes an informational message to the console.
void WriteInfo(string message)
Parameters
messagestringThe informational message to write.
WriteLine(string)
Writes a message to the console followed by a newline.
void WriteLine(string message)
Parameters
messagestringThe message to write.
WriteMarkup(string)
Writes a message with markup to the console.
void WriteMarkup(string markup)
Parameters
markupstringThe markup content to write.
WriteSuccess(string)
Writes a success message to the console.
void WriteSuccess(string message)
Parameters
messagestringThe success message to write.
WriteWarning(string)
Writes a warning message to the console.
void WriteWarning(string message)
Parameters
messagestringThe warning message to write.