GPUI.Command (gpui v0.2.0-rc.1)

Copy Markdown View Source

Declarative application command bound to a modified keyboard shortcut.

Command IDs are the same non-empty event names used by buttons and menus. Shortcuts use primary for Command on macOS and Control elsewhere, with optional ctrl, alt, and shift modifiers, for example primary-r or primary-shift-p.

Summary

Functions

Builds and validates one application command.

Converts a command into its renderer-independent protocol tuple.

Validates command count, IDs, shortcuts, and uniqueness.

Types

t()

@type t() :: %GPUI.Command{id: String.t(), shortcut: String.t()}

Functions

new(id, shortcut)

@spec new(String.t(), String.t()) :: t()

Builds and validates one application command.

to_payload(command)

@spec to_payload(t()) :: {String.t(), String.t()}

Converts a command into its renderer-independent protocol tuple.

validate_all!(commands)

@spec validate_all!([t()]) :: [t()]

Validates command count, IDs, shortcuts, and uniqueness.