Skip to content
ConsoleMonster
Class

AppCommand

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

One passive action definition shared by buttons, palettes and grid actions.

Inheritance

  • object
  • AppCommand

Usage

Explore 15 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 7

Constructors

public AppCommand(string key, string label, Func<AppActionContext, CancellationToken, Task> action) #

Creates an asynchronous action. The callback runs outside the app thread and must use its context to report output.

Parameters

key string required
label string required
action System.Func<ConsoleMonster.Interactive.AppActionContext, System.Threading.CancellationToken, System.Threading.Tasks.Task> required

Properties

public string Key { get; } #

Stable command identity, independent of the selected data row.

public string Label { get; } #

Visible action text.

public KeyChord? Shortcut { get; set; } #

Optional keyboard shortcut. Text editing retains precedence over plain character shortcuts.

public string? ConfirmPrompt { get; set; } #

Optional modal confirmation text. {Selection} expands to the captured row label or row count. Its default answer is No.

public Func<AppActionContext, CancellationToken, Task> Action { get; } #

The operation, which receives captured rows and cooperative cancellation.

Extension Methods

public static AppCommand WithConfirmPrompt(AppCommand appCommand, string? value) #

Sets AppCommand.ConfirmPrompt: Optional modal confirmation text. {Selection} expands to the captured row label or row count. Its default answer is No.

Parameters

appCommand ConsoleMonster.Interactive.AppCommand required
The instance.
value string? required
The value.

Returns

AppCommand The same instance.
public static AppCommand WithShortcut(AppCommand appCommand, KeyChord? value) #

Sets AppCommand.Shortcut: Optional keyboard shortcut. Text editing retains precedence over plain character shortcuts.

Parameters

appCommand ConsoleMonster.Interactive.AppCommand required
The instance.
value ConsoleMonster.Input.KeyChord? required
The value.

Returns

AppCommand The same instance.