Liking cljdoc? Tell your friends :D

hive-addon.registry.commands

Command contributions to a composite tool.

An addon contributes named subcommands to a host tool, so analysis command="lint ..." reaches the contributing addon's handler. Each contribution records the contributing addon so shutdown can retract everything that addon added.

Shape: {tool-name {command-name {:handler fn :params {} :description str :addon addon-id}}}

Command contributions to a composite tool.

An addon contributes named subcommands to a host tool, so
`analysis command="lint ..."` reaches the contributing addon's handler.
Each contribution records the contributing addon so shutdown can retract
everything that addon added.

Shape: {tool-name {command-name {:handler fn :params {} :description str
                                 :addon addon-id}}}
raw docstring

add-listener!clj/s

(add-listener! listener-id f)

Register f, called with a contribution event after every mutation here.

This seam exists because the STORE alone is not the whole concept. A host advertises a tool surface built from these contributions, and a contribution that arrives AFTER that surface was built has to tell it so. While only the host had listeners, an addon that migrated to this registry kept working at boot (the surface is assembled later anyway) and silently failed for any post-boot contribution, which is the worst shape of failure: correct on the path everyone tests, wrong on the path nobody does.

Idempotent by id: re-registering an id replaces its fn rather than stacking.

f MUST NOT THROW. This namespace is in the portable three-host stratum and carries no reader conditionals, so it cannot catch a platform exception class on the caller's behalf. A listener that can fail wraps itself; a JVM host registers an already-guarded fn. A throwing listener will propagate out of the contribute!/retract! that triggered it.

Register `f`, called with a contribution event after every mutation here.

This seam exists because the STORE alone is not the whole concept. A host
advertises a tool surface built from these contributions, and a contribution
that arrives AFTER that surface was built has to tell it so. While only the
host had listeners, an addon that migrated to this registry kept working at
boot (the surface is assembled later anyway) and silently failed for any
post-boot contribution, which is the worst shape of failure: correct on the
path everyone tests, wrong on the path nobody does.

Idempotent by id: re-registering an id replaces its fn rather than stacking.

`f` MUST NOT THROW. This namespace is in the portable three-host stratum and
carries no reader conditionals, so it cannot catch a platform exception class
on the caller's behalf. A listener that can fail wraps itself; a JVM host
registers an already-guarded fn. A throwing listener will propagate out of
the contribute!/retract! that triggered it.
sourceraw docstring

clear!clj/s

(clear!)

Remove every contribution. Returns nil.

Remove every contribution. Returns nil.
sourceraw docstring

contribute!clj/s

(contribute! tool-name addon-id commands)

Merge COMMANDS into TOOL-NAME's command tree on behalf of ADDON-ID. Notifies listeners afterwards. Returns the contributed command names.

Merge COMMANDS into TOOL-NAME's command tree on behalf of ADDON-ID.
Notifies listeners afterwards. Returns the contributed command names.
sourceraw docstring

contributed-tool-namesclj/s

(contributed-tool-names)

Every tool name carrying contributions.

Every tool name carrying contributions.
sourceraw docstring

get-commandsclj/s

(get-commands tool-name)

The contributed command tree for TOOL-NAME, or nil.

The contributed command tree for TOOL-NAME, or nil.
sourceraw docstring

listener-idsclj/s

(listener-ids)

Every registered listener id.

Every registered listener id.
sourceraw docstring

remove-listener!clj/s

(remove-listener! listener-id)

Drop a listener. Returns the id. Safe when absent.

Drop a listener. Returns the id. Safe when absent.
sourceraw docstring

retract!clj/s

(retract! tool-name addon-id)

Remove every command ADDON-ID contributed to TOOL-NAME. Notifies listeners afterwards. Returns nil.

Remove every command ADDON-ID contributed to TOOL-NAME. Notifies listeners
afterwards. Returns nil.
sourceraw docstring

retract-all!clj/s

(retract-all! addon-id)

Remove every command ADDON-ID contributed to any tool. Notifies listeners once per tool the addon had actually touched. Returns nil.

The touched set is read BEFORE the retraction, or there is nothing left to attribute the notifications to.

Remove every command ADDON-ID contributed to any tool. Notifies listeners
once per tool the addon had actually touched. Returns nil.

The touched set is read BEFORE the retraction, or there is nothing left to
attribute the notifications to.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close