{
"name" : "man",
"info" : {
"syntax" : "man <page>",
"brief" : "Display the manual page for the command 'page'",
},
"action" : function ( arg ) {
var out = '';
if ( arg == undefined || arg.length == 0 )
{
return "What manual page do you want?
\n";
}
var cmd = shell.json.commands;
if ( arg == 'blash' )
{
var commands = new Array();
out = 'Type "man <command>" for a more detailed help on these commands
';
for ( var i=0; i < cmd.length; i++ )
{
commands.push ( cmd[i].info.syntax );
}
commands.sort();
for ( var i in commands )
{
out += '' + commands[i] + '
';
}
return out;
}
var found = false;
for ( var i=0; i < cmd.length && !found; i++ )
{
if ( arg == cmd[i].name )
{
if ( cmd[i].info.syntax.length > 0 && cmd[i].info.brief.length > 0 )
{
found = true;
out =
'' + cmd[i].info.syntax + '
' +
'' + cmd[i].info.brief + '
';
}
}
}
if ( !found )
{
return "No manual entry for " + arg + "
\n";
}
return out;
},
}