Skip to content
ConsoleMonster
Class

ChangePreview

ConsoleMonster.Changes

Namespace
ConsoleMonster.Changes
Assembly
ConsoleMonster
Modifiers
static

The what-if pattern: show the changes an action would make, then ask before making them. A typed confirmation guards destructive changes. Returns the decision; the caller acts only on true.

Inheritance

  • object
  • ChangePreview

Methods

public static bool Ask(ChangeSet changes, ChangePreviewOptions? options = null, CancellationToken cancellationToken = default) #

Asks for confirmation of changes already shown (a typed confirmation for destructive ones).

Parameters

changes ConsoleMonster.Changes.ChangeSet required
The changes.
options ConsoleMonster.Changes.ChangePreviewOptions? = null optional
Options, or null.
cancellationToken System.Threading.CancellationToken = default optional
Cancels the prompt.

Returns

bool True when the user approved; false when declined or when there is nothing to change.
public static bool Confirm(ChangeSet changes, ChangePreviewOptions? options = null, CancellationToken cancellationToken = default) #

Shows the preview and asks for confirmation.

Parameters

changes ConsoleMonster.Changes.ChangeSet required
The changes.
options ConsoleMonster.Changes.ChangePreviewOptions? = null optional
Options, or null.
cancellationToken System.Threading.CancellationToken = default optional
Cancels the prompt.

Returns

bool True when the user approved; false when declined or when there is nothing to change.
public static void Show(ChangeSet changes, ChangePreviewOptions? options = null) #

Shows the preview only (the what-if half), with a note when there is nothing to change.

Parameters

changes ConsoleMonster.Changes.ChangeSet required
The changes.
options ConsoleMonster.Changes.ChangePreviewOptions? = null optional
Options, or null.