The first step in defining a command for Venkman is to add it to a .properties file. Here, you will define the UI Label, Parameter List, Help Text, and Hot Key associated with the command.

Definition of "break-props" and "cont" commands, from venkman.properties...
cmd.break-props.label  = Breakpoint &Properties...
cmd.break-props.params = <break-wrapper>
cmd.break-props.help   = Display the properties dialog for the breakpoint 
represented by <break-wrapper>.
<... snip ...>
cmd.cont.label = &Continue
cmd.cont.key   = VK_F5
cmd.cont.help  = Continue execution of the debug target.

Once you have described the command, you'll need to implement it somewhere. All commands take exactly one parameter, the ``event'' object e. This object is guaranteed to have all of the properties specified by the parameter list in the .properties file. Required parameters are guaranteed to be there, optional parameters will be set to null if they were not provided.

Implementation of "break-props" and "cont" commands, from venkman-commands.js...
function cmdBreakProps (e)
{
    if ("propsWindow" in e.breakWrapper)
    {
        e.breakWrapper.propsWindow.focus();
        return;
    }
        
    e.breakWrapper.propsWindow = 
        openDialog ("chrome://venkman/content/venkman-bpprops.xul", "",
                    "chrome,extrachrome,menubar,resizable", e.breakWrapper);
}

function cmdCont (e)
{
    disableDebugCommands();
    console.jsds.exitNestedEventLoop();
}

Now that you have the command specification and implementation, you can add it to the list of commands. The first column represents the command name, and should be the same name used in the .properties file. The second column is a reference to the function which implements the command. The third and final column lists the flags for the command. In Venkman, the CMD_CONSOLE flag means that the command is available in the Interactive Session view. CMD_NEED_STACK means that the user must be stopped at breakpoint for this command to be valid.

Registering commands, from venkman-commands.js...
function initCommands()
{
<... snip ...>
    var cmdary = [
         ["break-props",          cmdBreakProps,                            0],
         ["cont",                 cmdCont,       CMD_CONSOLE | CMD_NEED_STACK],
<... snip ...>
        ];

    console.commandManager.defineCommands (cmdary);
}