Skip to content

data/CommandSignature

Interfaces

SignatureArg

Defined in: data/CommandSignature.ts:13

Properties

name
name: string;

Defined in: data/CommandSignature.ts:15

Normalized arg name (lowercased, brackets/slash-variants stripped).

raw
raw: string;

Defined in: data/CommandSignature.ts:17

Original token as it appeared in the signature, brackets included.

label
label: string;

Defined in: data/CommandSignature.ts:23

User-facing label: the raw token with the optional-arg brackets stripped but slash variants and casing kept, so hints can show lat/acid/LEFT/... instead of collapsing it to lat.

optional
optional: boolean;

Defined in: data/CommandSignature.ts:25

True when the arg is wrapped in [...] brackets in the signature.

Variables

LOCAL_COMMAND_SIGNATURES

const LOCAL_COMMAND_SIGNATURES: Record<string, string>;

Defined in: data/CommandSignature.ts:48

Client-side commands handled by CommandHandler (never sent to the server), with user-facing signatures. The server's cmddict knows nothing about these, so the command palette merges this map into its list.

Keep in sync with CommandHandler's LOCAL_COMMANDS/PREPROCESSED_COMMANDS (a CommandHandler test asserts every handled command has an entry here).

Functions

getDisplaySignature()

function getDisplaySignature(name, rawSig): string;

Defined in: data/CommandSignature.ts:70

Return the signature to render in user-facing surfaces (arg hint, palette row). Falls back to the raw cmddict signature for everything that doesn't have an override.

Parameters

name

string

rawSig

string

Returns

string


getEffectiveDict()

function getEffectiveDict(cmddict): CommandDict;

Defined in: data/CommandSignature.ts:83

Merge the server's cmddict with WebATM's client-side command signatures.

The local signatures win on name collisions: CommandHandler intercepts those commands before they ever reach the server, so the local signature describes what actually happens. This is the dictionary every user-facing lookup (arg hint, ghost suggestion, autocomplete, palette) should use, so client-side commands like PAN resolve even before/without a server cmddict.

Parameters

cmddict

CommandDict | null

Returns

CommandDict


parseSignature()

function parseSignature(sig): SignatureArg[];

Defined in: data/CommandSignature.ts:98

Parse a cmddict signature into normalized argument descriptors.

Signatures look like: "callsign,type,lat,lon,hdg,alt,spd" "n,[lat,lon,lat,lon,type,alt,spd]" "callsign/ALL/WIND/shape"

We strip the optional-arg brackets, drop anything after a "/" variant separator, and lowercase the result so name matching is consistent.

Parameters

sig

string

Returns

SignatureArg[]


commandFromInput()

function commandFromInput(input): string | null;

Defined in: data/CommandSignature.ts:123

Extract the command name (uppercased) from raw input. Returns null when the input has no leading word.

Parameters

input

string

Returns

string | null


scoreCommand()

function scoreCommand(
   query, 
   name, 
   sig): number | null;

Defined in: data/CommandSignature.ts:140

Subsequence-based fuzzy score. Returns a non-negative number where lower is better, or null when the query characters can't be matched in order.

Scoring favors: - matches that start at the beginning of the candidate - contiguous matches (consecutive query chars hit consecutive haystack chars) over scattered ones

Case-insensitive. The signature is searched in addition to the name so a query like "head" matches HDG (signature contains "hdg").

Parameters

query

string

name

string

sig

string

Returns

number | null