This is a good default interface:
CmdUtils.CreateCommand({
name: "name",
description: "summary",
help: "content",
takes: {"what": noun_arb_text},
execute: function(what) {
// dispatch to server
}
})
Mapping to:
# ::ubiquity summary
# content
def cmd(what)
# returns {:inject, :script}
end
Advanced features include: * determination of 'what' name from
method * determination of mods using from method (see below) *
determining noun types from a comment signature (# what:: noun
type) * asynchronous noun type suggestion (map to some method) *
regexp noun type suggestion * specification of text, html, or
summary to provide for what (default text)
Determining mods from method
Proposal maps:
def cmd(what, in=, where=)
end
To:
CmdUtils.CreateCommand({
takes: {"what": noun_arb_text},
modifiers: {"in": noun_arb_text, "where": noun_arb_text},
execute: function(what, mods) {
// dispatch to server
}
})
Additional specifications
Could perhaps do it through lazydoc. Upside is that it can be
loaded without loading the code. Downside is that it's harder to
test and such.
Could make it a method... downside is the code has to be
loaded.
Could make a cmd.js file in views. This is perhaps best. It can
be rendered if it exists, to specify special behaviors. This is the
most flexible option, and in fact leads to the possibility of
simply registering commands.
# Sample::ubiqity description
[views/sample/cmd.js]
The cmd is rendered, if it exists, and default properties are
set if they don't already exist.
Actually, to be more clear:
[views/sample/cmd.js] # renders full command, substitute in
[views/sample/cmd.json] # simply specifies the options, merge with defaults