CommanderCommands
ConsoleMonster.Apps.Commander
The Commander's command registry: every command with its keys, label and availability, plus key routing (including type-to-search), the F-key bar and key bindings for the app host. F-keys follow Norton and Midnight Commander; each has an Alt+number alternative for terminals that swallow F-keys.
Inheritance
- object
- CommanderCommands
Usage
Explore 1 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.
Returned or exposed by 1
Constructors
public CommanderCommands(IEnumerable<CommanderCommand> commands) #Creates a registry. Keys and key chords must be unique, and each key-bar slot holds one command.
Parameters
- commands System.Collections.Generic.IEnumerable<ConsoleMonster.Apps.Commander.CommanderCommand>
- The commands.
Methods
public IReadOnlyList<KeyBinding> Bindings(CommanderContext context) #The commands as key bindings for the app host's routing, footer and key map.
Parameters
- context ConsoleMonster.Apps.Commander.CommanderContext
- The context their actions run in.
public static CommanderCommands CreateDefault() #The standard Commander commands.
public bool Dispatch(InputEvent input, CommanderContext context) #Routes a key: while a quick search is active, typing extends it, Backspace shortens it and Esc ends it; otherwise the bound command runs when available. Unbound printable characters start a quick search.
Parameters
- input ConsoleMonster.Input.InputEvent
- The event.
- context ConsoleMonster.Apps.Commander.CommanderContext
- The context.
Returns
bool Whether the key was handled; a bound but unavailable command still consumes its key.public CommanderCommand? Find(string key) #A command by key, or null.
Parameters
- key string
- The key, such as copy.
public IEnumerator<CommanderCommand> GetEnumerator() #Returns an enumerator that iterates through the collection.
Returns
IEnumerator<CommanderCommand> An enumerator that can be used to iterate through the collection.public IReadOnlyList<CommanderKeyBarItem> KeyBar(CommanderContext context, bool alternatives = false) #The ten F-key bar slots for the current context.
Parameters
- context ConsoleMonster.Apps.Commander.CommanderContext
- The context.
- alternatives bool = false
- Whether to show the Alt+number keys, for terminals that swallow F-keys.
public CommanderCommand? Match(InputEvent input) #The command bound to a key event, or null.
Parameters
- input ConsoleMonster.Input.InputEvent
- The event.
Inherited Methods
Properties
public CommanderCommand this[int index] { get; } #A command by position.
Parameters
- index int
- The position.