Class JsonConsole
- Namespace
- TypedRest.CommandLine.IO
- Assembly
- TypedRest.CommandLine.dll
Reads from and writes to the default system console (stdin/stdout/stderr) using JSON serialization for objects.
public class JsonConsole : IConsole
- Inheritance
-
JsonConsole
- Implements
- Inherited Members
Methods
Read(string)
Reads a text input.
public string Read(string prompt)
Parameters
promptstringThe prompt to ask the user.
Returns
ReadSecret(string)
Reads a secret text input.
public string ReadSecret(string prompt)
Parameters
promptstringThe prompt to ask the user.
Returns
Read<T>()
Reads an input object (usually in JSON format).
public T? Read<T>()
Returns
- T
Type Parameters
TThe type of object to read.
Write(object?)
Writes an output object (usually in JSON format).
public void Write(object? output)
Parameters
outputobject
WriteError(Exception)
Writes an exception as an error message.
public void WriteError(Exception exception)
Parameters
exceptionException
WriteError(string)
Writes an error message.
public void WriteError(string output)
Parameters
outputstring