chromakode / xkcdfools

xkcd CLI + jQuery terminal implementation
GNU General Public License v2.0
566 stars 116 forks source link

'help' command improvement... #14

Closed sgbeal closed 14 years ago

sgbeal commented 14 years ago

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.

chromakode commented 14 years ago

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?

sgbeal commented 14 years ago

i would indeed be interested. Some things i'd like to do/see done:

:)