Skip to content
ConsoleMonster
Class

WatchOptions

ConsoleMonster.Live

Namespace
ConsoleMonster.Live
Assembly
ConsoleMonster
Modifiers
sealed
Attributes
Fluent

Options for ConsoleWatch.Run.

Inheritance

  • object
  • WatchOptions

Usage

Explore 29 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 15

Constructors

public WatchOptions() #

Properties

public TimeSpan PollInterval { get; set; } #

The time between the end of one run and the start of the next (default 2 seconds, at least 50 ms).

public int Count { get; set; } #

How many runs; zero (default) follows until cancelled interactively, or prints one snapshot without a user.

public bool Differences { get; set; } #

Whether cells that changed since the previous run are highlighted.

public string? Title { get; set; } #

What is being watched, shown in the heading (markup), or null.

public bool? Live { get; set; } #

Whether to show a live view (true), print each run (false), or decide from the terminal (null, default): a live view only on an interactive terminal.

public LiveSessionOptions? Session { get; set; } #

The live session's options for the interactive view (inline with the final frame kept, by default).

public Action<IWidget>? Print { get; set; } #
Fluent("WriteTo")

Where a printed run goes when the view is not live, or null for the current terminal.

public Action<TimeSpan, CancellationToken>? Delay { get; set; } #
NoFluent

Waits between runs (for tests), or null for a real wait that ends early on cancellation.

Fields

public static readonly TimeSpan MinimumInterval #

The shortest interval (50 ms), so a watch never spins.

Extension Methods

public static WatchOptions Count(WatchOptions watchOptions, int value) #

Sets WatchOptions.Count: How many runs; zero (default) follows until cancelled interactively, or prints one snapshot without a user.

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
value int required
The value.

Returns

WatchOptions The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Live.WatchOptions { Count = value };    watchOptions.Count(value);
public static WatchOptions Differences(WatchOptions watchOptions, bool value = true) #

Sets WatchOptions.Differences: Whether cells that changed since the previous run are highlighted.

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
value bool = true optional
The value; true when omitted.

Returns

WatchOptions The same instance.

Examples

// C# initializer or property                                            // C# fluent
new global::ConsoleMonster.Live.WatchOptions { Differences = value };    watchOptions.Differences(value);
public static WatchOptions Live(WatchOptions watchOptions, bool? value) #

Sets WatchOptions.Live: Whether to show a live view (true), print each run (false), or decide from the terminal (null, default): a live view only on an interactive terminal.

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
value bool? required
The value.

Returns

WatchOptions The same instance.

Examples

// C# initializer or property                                     // C# fluent
new global::ConsoleMonster.Live.WatchOptions { Live = value };    watchOptions.Live(value);
public static WatchOptions PollInterval(WatchOptions watchOptions, TimeSpan value) #

Sets WatchOptions.PollInterval: The time between the end of one run and the start of the next (default 2 seconds, at least 50 ms).

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
value System.TimeSpan required
The value.

Returns

WatchOptions The same instance.

Examples

// C# initializer or property                                             // C# fluent
new global::ConsoleMonster.Live.WatchOptions { PollInterval = value };    watchOptions.PollInterval(value);
Session 2 overloads
public static WatchOptions Session(WatchOptions watchOptions, LiveSessionOptions? value) #

Sets WatchOptions.Session: The live session's options for the interactive view (inline with the final frame kept, by default).

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
value ConsoleMonster.Live.LiveSessionOptions? required
The value.

Returns

WatchOptions The same instance.

Examples

// C# initializer or property                                        // C# fluent
new global::ConsoleMonster.Live.WatchOptions { Session = value };    watchOptions.Session(value);
public static WatchOptions Session(WatchOptions watchOptions, Action<LiveSessionOptions> configure) #

Configures WatchOptions.Session in place (creating it when not set): The live session's options for the interactive view (inline with the final frame kept, by default).

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
configure System.Action<ConsoleMonster.Live.LiveSessionOptions> required
Configures the value.

Returns

WatchOptions The same instance.
public static WatchOptions Title(WatchOptions watchOptions, string? value) #

Sets WatchOptions.Title: What is being watched, shown in the heading (markup), or null.

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
value string? required
The value.

Returns

WatchOptions The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Live.WatchOptions { Title = value };    watchOptions.Title(value);
public static WatchOptions WriteTo(WatchOptions watchOptions, Action<IWidget>? value) #

Sets WatchOptions.Print: Where a printed run goes when the view is not live, or null for the current terminal.

Parameters

watchOptions ConsoleMonster.Live.WatchOptions required
The instance.
value System.Action<ConsoleMonster.Layout.IWidget>? required
The callback.

Returns

WatchOptions The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Live.WatchOptions { Print = value };    watchOptions.WriteTo(value);