'help' command improvement...
sgbeal opened this issue · 2 comments
in cli.js:
help: function help(terminal) {
terminal.print($('<h3>help</h3>'));
cmd_list = $('<ul>');
$.each(this.commands, function(name, func) {
if('shortHelp' in func ) {
name = name+': '+func.shortHelp;
}
cmd_list.append($('<li>').text(name));
});
terminal.print(cmd_list);
},
The only new part is the 'shortHelp' bit. If the command function has such a member, it is shown along with the command name. Obviously, helpful text is against the nature of the xkcd shell (which taunts the user at ever turn), but for the generic case it is a nice feature.
Thanks for the suggestion! This is actually something I was going to implement, but then found we wouldn't want to give away the help anyway (this the redefinition for the xkcd page). I think that it would be a logical step to make commands objects themselves, with information about help, arguments, and state. Would you be interested in hacking on this in a branch/fork?
i would indeed be interested. Some things i'd like to do/see done:
- Richer command objects, as you mention.
- Flesh out the Filesystem interface to include, e.g., function objects which can be run (e.g. command "exec foo").
- Get it working when the console is embedded in, e.g., a table. This would make it more embeddable. My initial attempt failed miserably.
:)