Skip to content
ConsoleMonster
Class

ConsoleView

ConsoleMonster.Views

Namespace
ConsoleMonster.Views
Assembly
ConsoleMonster
Modifiers
static

Picks the best view for data and builds it: one object becomes an inspector, objects of one shape a table (cards when narrow), hierarchical objects a tree, a numeric series a chart, strings highlighted code when a language is detected and text otherwise. Columns get presenters from their member names and types (CellPresenters.ForMember). Show-Console is the PowerShell front end.

Inheritance

  • object
  • ConsoleView

Methods

Auto 2 overloads
public static IWidget Auto(object? value, ConsoleViewOptions? options = null) #

Builds the automatic view for a value: a sequence is shown as its items, anything else as one item.

Parameters

value object? required
The value.
options ConsoleMonster.Views.ConsoleViewOptions? = null optional
Options, or null.

Returns

IWidget The widget.
public static IWidget Auto(IReadOnlyList<object?> items, ConsoleViewOptions? options = null) #

Builds the automatic (or requested) view for some items.

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
The items.
options ConsoleMonster.Views.ConsoleViewOptions? = null optional
Options, or null.

Returns

IWidget The widget.
public static BarChart BuildChart(IReadOnlyList<object?> items, ConsoleViewOptions? options = null) #

A bar chart: numbers as they are, or objects as label (first text member) and value (first number member).

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
The items.
options ConsoleMonster.Views.ConsoleViewOptions? = null optional
Options, or null.

Returns

BarChart The chart.
public static CodeView BuildCode(IReadOnlyList<object?> items, ConsoleViewOptions options) #

Builds highlighted code or JSON through the same representation factory as Show-Console.

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
Text or structured JSON input.
options ConsoleMonster.Views.ConsoleViewOptions required
Display configuration.

Returns

CodeView The configured code view.
public static IWidget BuildErrors(IReadOnlyList<object?> items, ConsoleViewOptions options) #

Builds one error view or a vertical sequence of error views.

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
Exceptions, ExceptionInfo descriptors or error messages.
options ConsoleMonster.Views.ConsoleViewOptions required
Error presentation configuration.

Returns

IWidget The error widget.
public static RecordView BuildList(IReadOnlyList<object?> items, ConsoleViewOptions options) #

Builds a record sheet from ordinary C# objects or dictionaries.

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
Records.
options ConsoleMonster.Views.ConsoleViewOptions required
Title, property selection and empty-field policy.

Returns

RecordView The record sheet.
public static Table BuildTable(IReadOnlyList<object?> items, ConsoleViewOptions? options = null) #

A table of the items' members, with presenters chosen by member name and type.

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
The items.
options ConsoleMonster.Views.ConsoleViewOptions? = null optional
Options, or null.

Returns

Table The table.
public static Tree BuildTree(IReadOnlyList<object?> items, ConsoleViewOptions? options = null) #

A tree of the items and their children (ConsoleViewOptions.ChildrenProperty or found automatically).

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
The items.
options ConsoleMonster.Views.ConsoleViewOptions? = null optional
Options, or null.

Returns

Tree The tree.
public static ConsoleViewKind Decide(IReadOnlyList<object?> items, ConsoleViewOptions? options = null) #

The view the data gets (see the class remarks): ConsoleViewOptions.View wins when set.

Parameters

items System.Collections.Generic.IReadOnlyList<object?> required
The items.
options ConsoleMonster.Views.ConsoleViewOptions? = null optional
Options, or null.

Returns

ConsoleViewKind The view.