MCPcopy Create free account
hub / github.com/anomalyco/opencode / register

Function register

packages/app/src/context/command.tsx:401–414  ·  view source on GitHub ↗
(key: string | (() => CommandOption[]), cb?: () => CommandOption[])

Source from the content-addressed store, hash-verified

399 function register(cb: () => CommandOption[]): void
400 function register(key: string, cb: () => CommandOption[]): void
401 function register(key: string | (() => CommandOption[]), cb?: () => CommandOption[]) {
402 const id = typeof key === "string" ? key : undefined
403 const next = typeof key === "function" ? key : cb
404 if (!next) return
405 const options = createMemo(next)
406 const entry: CommandRegistration = {
407 key: id,
408 options,
409 }
410 setStore("registrations", (arr) => upsertCommandRegistration(arr, entry))
411 onCleanup(() => {
412 setStore("registrations", (arr) => arr.filter((x) => x !== entry))
413 })
414 }
415
416 const keybindConfig = (id: string) => {
417 if (id === PALETTE_ID) return settings.keybinds.get(PALETTE_ID) ?? DEFAULT_PALETTE_KEYBIND

Callers

nothing calls this directly

Calls 2

setStoreFunction · 0.85

Tested by

no test coverage detected