Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Command interface

#4

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

Reported by bahuvrihi · March 10th, 2009 @ 09:23 PM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. bahuvrihi
    bahuvrihi
    • State changed from new to invalid

    March 15th, 2009 @ 11:13 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.