Skip to content
ConsoleMonster
Class

CommandOptions

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

Configuration for an action whose identity and callback become immutable at Build.

Inheritance

  • object
  • CommandOptions

Usage

Explore 25 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 14

Constructors

public CommandOptions() #

Properties

public string Key { get; set; } #

The stable command key.

public string? Label { get; set; } #

The visible label; null uses Key.

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

The asynchronous operation over captured rows and cancellation.

public KeyChord? Shortcut { get; set; } #

The optional keyboard shortcut.

public string? ConfirmPrompt { get; set; } #

The optional confirmation prompt.

Extension Methods

public static AppCommand Build(CommandOptions options) #

Creates an asynchronous action after its immutable identity and callback have been configured.

Parameters

options ConsoleMonster.Interactive.CommandOptions required
The configured definition.

Returns

AppCommand The command.
public static CommandOptions Configure(CommandOptions commandOptions, Action<CommandOptions> configure) #

Assigns callbacks and related configuration without invoking delegate-valued properties.

Parameters

commandOptions ConsoleMonster.Interactive.CommandOptions required
The instance.
configure System.Action<ConsoleMonster.Interactive.CommandOptions> required
Assignments applied in order.

Returns

CommandOptions The same instance.

Examples

// C# initializer or property                                                // C# fluent
new global::ConsoleMonster.Interactive.CommandOptions { Action = value };    Ui.Command().Configure(configured => configured.Action = value);
public static CommandOptions ConfirmPrompt(CommandOptions commandOptions, string? value) #

Sets CommandOptions.ConfirmPrompt: The optional confirmation prompt.

Parameters

commandOptions ConsoleMonster.Interactive.CommandOptions required
The instance.
value string? required
The value.

Returns

CommandOptions The same instance.

Examples

// C# initializer or property                                                       // C# fluent
new global::ConsoleMonster.Interactive.CommandOptions { ConfirmPrompt = value };    Ui.Command().ConfirmPrompt(value);
public static CommandOptions Key(CommandOptions commandOptions, string value) #

Sets CommandOptions.Key: The stable command key.

Parameters

commandOptions ConsoleMonster.Interactive.CommandOptions required
The instance.
value string required
The value.

Returns

CommandOptions The same instance.

Examples

// C# initializer or property                                             // C# fluent
new global::ConsoleMonster.Interactive.CommandOptions { Key = value };    Ui.Command().Key(value);
public static CommandOptions Label(CommandOptions commandOptions, string? value) #

Sets CommandOptions.Label: The visible label; null uses Key.

Parameters

commandOptions ConsoleMonster.Interactive.CommandOptions required
The instance.
value string? required
The value.

Returns

CommandOptions The same instance.

Examples

// C# initializer or property                                               // C# fluent
new global::ConsoleMonster.Interactive.CommandOptions { Label = value };    Ui.Command().Label(value);
public static CommandOptions Shortcut(CommandOptions commandOptions, KeyChord? value) #

Sets CommandOptions.Shortcut: The optional keyboard shortcut.

Parameters

commandOptions ConsoleMonster.Interactive.CommandOptions required
The instance.
value ConsoleMonster.Input.KeyChord? required
The value.

Returns

CommandOptions The same instance.

Examples

// C# initializer or property                                                  // C# fluent
new global::ConsoleMonster.Interactive.CommandOptions { Shortcut = value };    Ui.Command().Shortcut(value);