CLI-style subcommand dispatch for a consolidated tool.
make-handler turns a handler tree into a single fn dispatching on the
:command parameter, supporting n-depth paths ("status list") alongside
single-word commands.
CLI-style subcommand dispatch for a consolidated tool.
`make-handler` turns a handler tree into a single fn dispatching on the
:command parameter, supporting n-depth paths ("status list") alongside
single-word commands.(make-handler handlers)(make-handler handlers {:keys [coerce-schema error-fn]})A handler fn dispatching on the :command parameter of its argument map.
HANDLERS maps keyword segments to handler fns or to nested trees; a tree may carry :_handler as its default. "help" at the root renders the command list.
OPTS:
:coerce-schema {field [type-spec]} — string params are coerced to the
declared types before dispatch (see hive-dsl.coerce)
:error-fn builds an error result; defaults to
hive-addon.cli.response/error, and a host may pass its
own enriched builder
A handler fn dispatching on the :command parameter of its argument map.
HANDLERS maps keyword segments to handler fns or to nested trees; a tree
may carry :_handler as its default. "help" at the root renders the
command list.
OPTS:
:coerce-schema {field [type-spec]} — string params are coerced to the
declared types before dispatch (see hive-dsl.coerce)
:error-fn builds an error result; defaults to
`hive-addon.cli.response/error`, and a host may pass its
own enriched buildercljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |