Skip to content
ConsoleMonster

API Reference

Class

ChangePreview

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 Boolean Ask(ChangeSet changes, ChangePreviewOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Boolean

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

Parameters

changes ConsoleMonster.Changes.ChangeSet requiredposition: 0
The changes.
options ConsoleMonster.Changes.ChangePreviewOptions? = null optionalposition: 1
Options, or null.
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Cancels the prompt.

Returns

True when the user approved; false when declined or when there is nothing to change.

public static Boolean Confirm(ChangeSet changes, ChangePreviewOptions? options = null, CancellationToken cancellationToken = default) #
Returns: Boolean

Shows the preview and asks for confirmation.

Parameters

changes ConsoleMonster.Changes.ChangeSet requiredposition: 0
The changes.
options ConsoleMonster.Changes.ChangePreviewOptions? = null optionalposition: 1
Options, or null.
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Cancels the prompt.

Returns

True when the user approved; false when declined or when there is nothing to change.

public static Void Show(ChangeSet changes, ChangePreviewOptions? options = null) #
Returns: Void

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

Parameters

changes ConsoleMonster.Changes.ChangeSet requiredposition: 0
The changes.
options ConsoleMonster.Changes.ChangePreviewOptions? = null optionalposition: 1
Options, or null.