Table of Contents

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

prompt string

The prompt to ask the user.

Returns

string

ReadSecret(string)

Reads a secret text input.

string ReadSecret(string prompt)

Parameters

prompt string

The prompt to ask the user.

Returns

string

Read<T>()

Reads an input object (usually in JSON format).

T? Read<T>()

Returns

T

Type Parameters

T

The type of object to read.

Write(object?)

Writes an output object (usually in JSON format).

void Write(object? output)

Parameters

output object

WriteError(Exception)

Writes an exception as an error message.

void WriteError(Exception exception)

Parameters

exception Exception

WriteError(string)

Writes an error message.

void WriteError(string output)

Parameters

output string