Command definitions
Command definitions
(cmd-meta fun extra-meta)
Extract meta information for a command function, given its var
Extract meta information for a command function, given its var
(default-on-cmd on-err on-404 can-exec? cli input)
The default on-cmd handler; if there is anything on the input stack, it will delegate to that. Othewise, it will call (exec-command) with the default cmdset
The default on-cmd handler; if there is anything on the input stack, it will delegate to that. Othewise, it will call (exec-command) with the default cmdset
(defcmd cmd-name & decl)
Declare a command that can be invoked from the default on-cmd handler. The syntax is similar to (defn), including support for multi-arity. Note, however, that same-arity with different argtypes is NOT supported.
The cmd-name may be annotated with ^:no-abbrev if the command may only be executed by inputting the full name; otherwise, abbreviations will be generated starting from the first letter, then the first two letters, and so on.
Alternatively, you may annotate with eg ^{:abbrev ["w" "west"]}
to explicitly declare what invocations may be used.
Here, you must include the full name; rainboots will not generate
any abbreviations.
Declare a command that can be invoked from the default on-cmd handler. The syntax is similar to (defn), including support for multi-arity. Note, however, that same-arity with different argtypes is NOT supported. The cmd-name may be annotated with ^:no-abbrev if the command may only be executed by inputting the full name; otherwise, abbreviations will be generated starting from the first letter, then the first two letters, and so on. Alternatively, you may annotate with eg `^{:abbrev ["w" "west"]}` to explicitly declare what invocations may be used. Here, you *must* include the full name; rainboots will not generate *any* abbreviations.
(defcmdset set-name & cmd-defs)
Declare a command set. Command sets can be pushed and popped. Command sets have a def'd name by which you can refer to them when pushing and popping.
A typical declaration will look like:
(defcmdset basic
(defcmd look
[cli]
(send! cli "You see some stuff")))
Declare a command set. Command sets can be pushed and popped. Command sets have a def'd name by which you can refer to them when pushing and popping. A typical declaration will look like: ``` (defcmdset basic (defcmd look [cli] (send! cli "You see some stuff"))) ```
(exec-command on-404 can-exec? cli input)
Attempts to execute a command from the default commands set; returns true on success; calls on-404 and returns false on failure
Attempts to execute a command from the default commands set; returns true on success; calls on-404 and returns false on failure
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close