Command-path parsing and handler-tree resolution.
A handler tree maps keyword segments either to a handler fn or to a nested tree. A nested tree may carry :_handler as the value used when a path stops there, or when no deeper segment matches.
Command-path parsing and handler-tree resolution. A handler tree maps keyword segments either to a handler fn or to a nested tree. A nested tree may carry :_handler as the value used when a path stops there, or when no deeper segment matches.
(collect-command-paths handlers prefix)Every callable path in HANDLERS as a seq of keyword vectors, PREFIX prepended. A subtree carrying :_handler also contributes its own path.
Every callable path in HANDLERS as a seq of keyword vectors, PREFIX prepended. A subtree carrying :_handler also contributes its own path.
(format-help handlers)Help text listing every command path in HANDLERS, one per line.
Help text listing every command path in HANDLERS, one per line.
(normalize-command command)COMMAND as a string. Accepts a keyword or a string; anything else is nil.
COMMAND as a string. Accepts a keyword or a string; anything else is nil.
(parse-command command)COMMAND parsed into a keyword path: "status list" -> [:status :list]. Nil for a nil or blank command.
COMMAND parsed into a keyword path: "status list" -> [:status :list]. Nil for a nil or blank command.
(resolve-handler handlers path)Walk HANDLERS along PATH.
Returns {:handler fn :path-used [...] :remaining [...]} on a hit, {:tree subtree :path-used [...]} when the path stops at a subtree with no :_handler, or {:error :not-found :path-used [...] :remaining [...]} when a segment does not match and no :_handler is available.
Walk HANDLERS along PATH.
Returns {:handler fn :path-used [...] :remaining [...]} on a hit,
{:tree subtree :path-used [...]} when the path stops at a subtree with no
:_handler, or {:error :not-found :path-used [...] :remaining [...]} when a
segment does not match and no :_handler is available.cljdoc 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 |