Interface IConsole
- Namespace
- TypedRest.CommandLine.IO
- Assembly
- TypedRest.CommandLine.dll
Represents a text input/output device (e.g. a terminal/console) and a serialization strategy for objects.
public interface IConsole
Methods
Read(string)
Reads a text input.
string Read(string prompt)
Parameters
promptstringThe prompt to ask the user.
Returns
ReadSecret(string)
Reads a secret text input.
string ReadSecret(string prompt)
Parameters
promptstringThe prompt to ask the user.
Returns
Read<T>()
Reads an input object (usually in JSON format).
T? Read<T>()
Returns
- T
Type Parameters
TThe type of object to read.
Write(object?)
Writes an output object (usually in JSON format).
void Write(object? output)
Parameters
outputobject
WriteError(Exception)
Writes an exception as an error message.
void WriteError(Exception exception)
Parameters
exceptionException
WriteError(string)
Writes an error message.
void WriteError(string output)
Parameters
outputstring