Skip to content
Snippets Groups Projects
Commit e8aaecc6 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Beautify the "help" output

Both the and the output are not prettier.

This fixes issue #901
parent b55f8621
No related branches found
No related tags found
No related merge requests found
...@@ -27,9 +27,6 @@ if(argc>0) ...@@ -27,9 +27,6 @@ if(argc>0)
else if(bbs.command_str && bbs.command_str != '') else if(bbs.command_str && bbs.command_str != '')
str_cmds(bbs.command_str); // otherwise, use command shell 'str' var, if supported (v3.13b) str_cmds(bbs.command_str); // otherwise, use command shell 'str' var, if supported (v3.13b)
// For testing...
//str_cmds(console.getstr("",60));
function str_cmds(str) function str_cmds(str)
{ {
var file; // File var file; // File
...@@ -41,6 +38,7 @@ function str_cmds(str) ...@@ -41,6 +38,7 @@ function str_cmds(str)
var m; // Temp integer var m; // Temp integer
var a; // Temp array var a; // Temp array
var s; // Temp string var s; // Temp string
var help = []; // Command descriptions
// Remove any trailing spaces // Remove any trailing spaces
...@@ -57,8 +55,6 @@ function str_cmds(str) ...@@ -57,8 +55,6 @@ function str_cmds(str)
return; return;
log("Invoked string command: " + str); log("Invoked string command: " + str);
bbs.log_str(str); bbs.log_str(str);
if(str=="HELP")
write("\r\nAvailable commands\r\n\r\n");
var node_action = bbs.node_action; var node_action = bbs.node_action;
if(bbs.compare_ars("SYSOP")) { if(bbs.compare_ars("SYSOP")) {
...@@ -67,9 +63,7 @@ function str_cmds(str) ...@@ -67,9 +63,7 @@ function str_cmds(str)
//sync //sync
// ######################## SYSOP Functions ############################## // ######################## SYSOP Functions ##############################
if(str=="HELP") { help["AVAIL"] = "Toggle sysop chat availability";
writeln("AVAIL\tToggle sysop chat availability");
}
if(str=="AVAIL") { if(str=="AVAIL") {
system.operator_available = !system.operator_available; system.operator_available = !system.operator_available;
write(format(bbs.text(text.LiSysopIs) write(format(bbs.text(text.LiSysopIs)
...@@ -77,10 +71,7 @@ function str_cmds(str) ...@@ -77,10 +71,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["ERR"] = "Display current error log and optionally delete it, as well as optionally clearing all nodes' error counters";
writeln("ERR\tDisplay current error log and optionally delete it, as well as");
writeln("\toptionally clearing all nodes' error counters.");
}
if(str=="ERR") { if(str=="ERR") {
var errlog=system.logs_dir+"error.log"; var errlog=system.logs_dir+"error.log";
if(file_exists(errlog)) { if(file_exists(errlog)) {
...@@ -107,8 +98,7 @@ function str_cmds(str) ...@@ -107,8 +98,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") help["GURU"] = "Display and optionally clear current guru log";
writeln("GURU\tDisplay and optionally clear current guru log.");
if(str=="GURU") { if(str=="GURU") {
if(file_exists(system.logs_dir+"guru.log")) { if(file_exists(system.logs_dir+"guru.log")) {
console.printfile(system.logs_dir+"guru.log"); console.printfile(system.logs_dir+"guru.log");
...@@ -118,18 +108,14 @@ function str_cmds(str) ...@@ -118,18 +108,14 @@ function str_cmds(str)
} }
} }
if(str=="HELP") help["CHUSER"] = "Become a different user";
writeln("CHUSER\tBecome a different user.");
if(str=="CHUSER") { if(str=="CHUSER") {
// Prompts for syspass // Prompts for syspass
bbs.change_user(); bbs.change_user();
return; return;
} }
if(str=="HELP") { help["TYPE [filename]"] = "Displays a file. Aliases: LIST and CAT";
writeln("TYPE [filename]");
writeln("\tDisplays a file. Aliases: LIST and CAT");
}
if(word=="LIST" || word=="TYPE" || word=="CAT") { if(word=="LIST" || word=="TYPE" || word=="CAT") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(4); str=str.substr(4);
...@@ -138,10 +124,7 @@ function str_cmds(str) ...@@ -138,10 +124,7 @@ function str_cmds(str)
} }
} }
if(str=="HELP") { help["ECHO [string]"] = "Print a text message";
writeln("ECHO [string]");
writeln("\tPrint a text message.");
}
if(word=="ECHO") { if(word=="ECHO") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(4); str=str.substr(4);
...@@ -151,10 +134,7 @@ function str_cmds(str) ...@@ -151,10 +134,7 @@ function str_cmds(str)
} }
} }
if(str=="HELP") { help["EVAL [string]"] = "Evaluate a JavaScript expression and display result";
writeln("EVAL [string]");
writeln("\tEvaluate a JavaScript expression and display result.");
}
if(word=="EVAL") { if(word=="EVAL") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(4); str=str.substr(4);
...@@ -170,8 +150,7 @@ function str_cmds(str) ...@@ -170,8 +150,7 @@ function str_cmds(str)
} }
} }
if(str=="HELP") help["EDIT"] = "Edits a specified file using your message editor";
writeln("EDIT\tEdits a specified file using your message editor.");
if(word=="EDIT") { if(word=="EDIT") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(4); str=str.substr(4);
...@@ -179,8 +158,7 @@ function str_cmds(str) ...@@ -179,8 +158,7 @@ function str_cmds(str)
} }
} }
if(str=="HELP") help["LOG"] = "Displays todays activity log";
writeln("LOG\tDisplays todays activity log");
if(str=="LOG") { if(str=="LOG") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=system.logs_dir+strftime("logs/%m%d%y.log",time()); str=system.logs_dir+strftime("logs/%m%d%y.log",time());
...@@ -189,8 +167,7 @@ function str_cmds(str) ...@@ -189,8 +167,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") help["YLOG"] = "Displays yesterdays activity log";
writeln("YLOG\tDisplays yesterdays activity log.");
if(str=="YLOG") { if(str=="YLOG") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60);
...@@ -199,15 +176,13 @@ function str_cmds(str) ...@@ -199,15 +176,13 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") help["SS"] = "Displays current system stats";
writeln("SS\tDisplays current system stats");
if(str=="SS") { if(str=="SS") {
bbs.sys_stats(); bbs.sys_stats();
return; return;
} }
if(str=="HELP") help["NS <#>"] = "Displays the current node stats for node #";
writeln("NS <#>\tDisplays the current node stats for node #.");
if(word=="NS") { if(word=="NS") {
str=str.substr(2); str=str.substr(2);
i=parseInt(get_nodenum(str)); i=parseInt(get_nodenum(str));
...@@ -216,10 +191,7 @@ function str_cmds(str) ...@@ -216,10 +191,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["EXEC [command]"] = "Executes command (or prompts for it) with I/O redirected";
writeln("EXEC [command]");
writeln("\texecutes command (or prompts for it) with I/O redirected.");
}
if(word=="EXEC") { if(word=="EXEC") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(4); str=str.substr(4);
...@@ -234,11 +206,7 @@ function str_cmds(str) ...@@ -234,11 +206,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["NEXEC [command]"] = "Executes command (or prompts for it) with I/O redirected, and assuming it's a native binary";
writeln("NEXEC [command]");
writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming");
writeln("\tit's a native binary.");
}
if(word=="NEXEC") { if(word=="NEXEC") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(5); str=str.substr(5);
...@@ -249,11 +217,7 @@ function str_cmds(str) ...@@ -249,11 +217,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["FOSSIL [command]"] = "Executes command (or prompts for it) with I/O redirected, and assuming the internal FOSSIL driver will be used";
writeln("FOSSIL [command]");
writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming");
writeln("\tthe internal FOSSIL driver will be used.");
}
if(word=="FOSSIL") { if(word=="FOSSIL") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(6); str=str.substr(6);
...@@ -264,10 +228,7 @@ function str_cmds(str) ...@@ -264,10 +228,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["CALL <HubID>"] = "Forces a callout to QWKnet HubID";
writeln("CALL <HubID>");
writeln("\tforces a callout to QWKnet HubID");
}
if(word=="CALL") { if(word=="CALL") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(4); str=str.substr(4);
...@@ -278,10 +239,7 @@ function str_cmds(str) ...@@ -278,10 +239,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["EVENT [EventID]"] = "Forces a timed-event to execute via semfile";
writeln("EVENT [EventID]");
writeln("\tforces a timed-event to execute via semfile");
}
if(word=="EVENT") { if(word=="EVENT") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str = str.substr(5); str = str.substr(5);
...@@ -307,19 +265,13 @@ function str_cmds(str) ...@@ -307,19 +265,13 @@ function str_cmds(str)
} }
if(str=="HELP") { help["NODE [parameters]"] = "Executes the node utility with the passed parameters";
writeln("NODE [parameters]");
writeln("\texecutes the node utility with the passed parameters.");
}
if(word=="NODE") { if(word=="NODE") {
bbs.exec(bbs.cmdstr("%!node%. -pause ") + str.substr(4), EX_STDIO|EX_NATIVE); bbs.exec(bbs.cmdstr("%!node%. -pause ") + str.substr(4), EX_STDIO|EX_NATIVE);
return; return;
} }
if(str=="HELP") { help["DOWN [#]"] = "Downs node #. If # is omitted, downs the current node";
writeln("DOWN [#]");
writeln("\tdowns node #. If # is omitted, downs the current node.");
}
if(word=="DOWN") { if(word=="DOWN") {
str=str.substr(4); str=str.substr(4);
i=parseInt(get_nodenum(str)); i=parseInt(get_nodenum(str));
...@@ -337,10 +289,7 @@ function str_cmds(str) ...@@ -337,10 +289,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["RERUN [#]"] = "Marks node # for rerun. If # is omitted, reruns the current node";
writeln("RERUN [#]");
writeln("\tMarks node # for rerun. If # is omitted, reruns the current node.");
}
if(word=="RERUN") { if(word=="RERUN") {
str=str.substr(5); str=str.substr(5);
i=parseInt(get_nodenum(str)); i=parseInt(get_nodenum(str));
...@@ -355,25 +304,19 @@ function str_cmds(str) ...@@ -355,25 +304,19 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") help["RELOAD"] = "Reload the current shell (if JavaScript)";
writeln("RELOAD\tReload the current shell (if JavaScript).");
if(str=="RELOAD") { if(str=="RELOAD") {
bbs.load_user_text(); bbs.load_user_text();
exit(0); exit(0);
} }
if(str=="HELP") help["SLOG"] = "Executes the slog utility to display system statistics";
writeln("SLOG\tExecutes the slog utility to display system statistics.");
if(str=="SLOG") { if(str=="SLOG") {
bbs.exec(bbs.cmdstr("%!slog%. /p"),EX_STDIO|EX_NATIVE); bbs.exec(bbs.cmdstr("%!slog%. /p"),EX_STDIO|EX_NATIVE);
return; return;
} }
if(str=="HELP") { help["NLOG [#]"] = "Executes the slog utility to display node stats for the specified node. If # is omitted, uses the current node";
writeln("NLOG [#]");
writeln("\tExecutes the slog utility to display node stats for the specified node.");
writeln("\tIf # is omitted, uses the current node.");
}
if(str=="NLOG") { if(str=="NLOG") {
bbs.exec(bbs.cmdstr("%!slog%. %n /p"),EX_STDIO|EX_NATIVE); bbs.exec(bbs.cmdstr("%!slog%. %n /p"),EX_STDIO|EX_NATIVE);
return; return;
...@@ -384,10 +327,7 @@ function str_cmds(str) ...@@ -384,10 +327,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["UEDIT [Number or Name]"] = "Edits specified user or starts at user #1";
writeln("UEDIT [Number or Name]");
writeln("\tEdits specified user or starts at user #1");
}
if(word=="UEDIT") { if(word=="UEDIT") {
// Prompts for syspass // Prompts for syspass
str=str.substr(5).trim(); str=str.substr(5).trim();
...@@ -403,17 +343,13 @@ function str_cmds(str) ...@@ -403,17 +343,13 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") help["MAIL"] = "Read all mail currently in the mail base";
writeln("MAIL\tRead all mail currently in the mail base");
if(str=="MAIL") { if(str=="MAIL") {
bbs.read_mail(MAIL_ALL); bbs.read_mail(MAIL_ALL);
return; return;
} }
if(str=="HELP") { help["BULKMAIL"] = "Sends a mail to all users which match a specified ARS";
writeln("BULKMAIL");
writeln("\tSends a mail to all users which match a specified ARS.");
}
if(str=="BULKMAIL") { if(str=="BULKMAIL") {
write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("\r\nEnter ARS matches to send mail to or [CR] to send ");
write("by name/number\r\nARS to match: "); write("by name/number\r\nARS to match: ");
...@@ -423,9 +359,7 @@ function str_cmds(str) ...@@ -423,9 +359,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["DOS"] = "Executes the DOS shell (command.com) with I/O redirected";
writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected.");
}
if(str=="DOS") { // DOS/Windows shell if(str=="DOS") { // DOS/Windows shell
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
bbs.exec("command.com",EX_STDIO); bbs.exec("command.com",EX_STDIO);
...@@ -433,8 +367,7 @@ function str_cmds(str) ...@@ -433,8 +367,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") help["SHELL"] = "Executes the native shell (COMSPEC or SHELL env variable)";
writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable).");
if(str=="SHELL") { // Unix shell (-i for interactive) if(str=="SHELL") { // Unix shell (-i for interactive)
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
if(system.platform != 'Win32') if(system.platform != 'Win32')
...@@ -445,10 +378,7 @@ function str_cmds(str) ...@@ -445,10 +378,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["SPY <#>"] = "Spys on node #";
writeln("SPY <#>");
writeln("\tSpys on node #.");
}
if(word=="SPY") { if(word=="SPY") {
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
str=str.substr(3); str=str.substr(3);
...@@ -465,21 +395,14 @@ function str_cmds(str) ...@@ -465,21 +395,14 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["LOAD [filespec]"] = "Loads the text.dat from the specified filespec";
writeln("LOAD [filespec]");
writeln("\tLoads the text.dat from the specified filespec.");
}
if(word=="LOAD") { if(word=="LOAD") {
str=str.substr(4); str=str.substr(4);
bbs.load_text(get_filename(str)); bbs.load_text(get_filename(str));
return; return;
} }
if(str=="HELP") { help["DIR [path]"] = "Displays a full directory of specified path or the current file area if not specified";
writeln("DIR [path]");
writeln("\tDisplays a full directory of specified path or the current file area if");
writeln("\tnot specified");
}
if(str=="DIR" && node_action == NODE_XFER) { if(str=="DIR" && node_action == NODE_XFER) {
// Dir of current lib: // Dir of current lib:
if(bbs.check_syspass()) { if(bbs.check_syspass()) {
...@@ -553,14 +476,10 @@ function str_cmds(str) ...@@ -553,14 +476,10 @@ function str_cmds(str)
if(node_action == NODE_XFER) { if(node_action == NODE_XFER) {
help["UPLOAD [areaspec]"] =
if(str=="HELP") { "Performs a bulk upload in areaspec where area spec is ALL, LIB, or omitted. " +
writeln("UPLOAD [areaspec]"); "If areaspec is ALL performs the bulk upload in all file areas. " +
writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); "If areaspec is LIB, does the same in all areas of the current lib";
writeln("\tomitted.");
writeln("\tIf areaspec is ALL performs the bulk upload in all file areas.");
writeln("\tIf areaspec is LIB, does the same in all areas of the current lib.");
}
if(word=="UPLOAD") { if(word=="UPLOAD") {
str=str.substr(7); str=str.substr(7);
if(str.toUpperCase()=="ALL") { if(str.toUpperCase()=="ALL") {
...@@ -591,14 +510,9 @@ function str_cmds(str) ...@@ -591,14 +510,9 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["OLDUL [ALL|LIB|blank]"] = "Lists all files uploaded before your last scan time";
writeln("OLDUL [ALL|LIB|blank]"); help["OLD [ALL|LIB|blank]"] = "Lists all files not downloaded since your last scan time";
writeln("\tLists all files uploaded before your last scan time."); help["OFFLINE [ALL|LIB|blank]"] = "Lists all offline files";
writeln("OLD [ALL|LIB|blank]");
writeln("\tLists all files not downloaded since your last scan time.");
writeln("OFFLINE [ALL|LIB|blank]");
writeln("\tLists all offline files.");
}
if(word=="OLDUL" || word=="OLD" || word=="OFFLINE") { if(word=="OLDUL" || word=="OLD" || word=="OFFLINE") {
str=str.replace(/^[A-Z]*\s/,""); str=str.replace(/^[A-Z]*\s/,"");
if(file_area.lib_list.length<1) if(file_area.lib_list.length<1)
...@@ -667,10 +581,7 @@ function str_cmds(str) ...@@ -667,10 +581,7 @@ function str_cmds(str)
} }
} }
if(str=="HELP") { help["GET [path]"] = "Download the specified file";
writeln("GET [path]");
writeln("\tDownload the specified file");
}
if(word=="GET") { if(word=="GET") {
str=str.substr(3); str=str.substr(3);
str=str.replace(/^\s+/,""); str=str.replace(/^\s+/,"");
...@@ -691,10 +602,7 @@ function str_cmds(str) ...@@ -691,10 +602,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["PUT [path]"] = "Upload the specified file";
writeln("PUT [path]");
writeln("\tUpload the specified file");
}
if(word=="PUT") { if(word=="PUT") {
str=str.substr(3); str=str.substr(3);
str=str.replace(/^\s+/,""); str=str.replace(/^\s+/,"");
...@@ -717,8 +625,7 @@ function str_cmds(str) ...@@ -717,8 +625,7 @@ function str_cmds(str)
//# Quiet Node //# Quiet Node
if(user.compare_ars("exempt Q")) { if(user.compare_ars("exempt Q")) {
if(str=="HELP") help["QUIET"]="Toggles quiet setting (you are not listed as online)";
writeln("QUIET\tToggles quiet setting (you are not listed as online).");
if(str=="QUIET") { if(str=="QUIET") {
if(system.node_list[bbs.node_num-1].status==NODE_QUIET) if(system.node_list[bbs.node_num-1].status==NODE_QUIET)
system.node_list[bbs.node_num-1].status=NODE_INUSE; system.node_list[bbs.node_num-1].status=NODE_INUSE;
...@@ -728,10 +635,7 @@ function str_cmds(str) ...@@ -728,10 +635,7 @@ function str_cmds(str)
return; return;
} }
if(str=="HELP") { help["ANON"] = "Toggles anonymous setting (the node is listed online, but you are not mentioned)";
writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not");
writeln("\tmentioned).");
}
if(str=="ANON") { if(str=="ANON") {
system.node_list[bbs.node_num-1].misc ^= NODE_ANON; system.node_list[bbs.node_num-1].misc ^= NODE_ANON;
display_node(bbs.node_num); display_node(bbs.node_num);
...@@ -741,10 +645,7 @@ function str_cmds(str) ...@@ -741,10 +645,7 @@ function str_cmds(str)
// Lock Node // Lock Node
if(user.compare_ars("exempt N")) { if(user.compare_ars("exempt N")) {
if(str=="HELP") { help["LOCK [#]"] = "Locks the specified node, or the current node if none specified";
writeln("LOCK [#]");
writeln("\tLocks the specified node, or the current node if none specified.");
}
if(word=="LOCK") { if(word=="LOCK") {
str=str.substr(4); str=str.substr(4);
i=parseInt(get_nodenum(str)); i=parseInt(get_nodenum(str));
...@@ -762,10 +663,7 @@ function str_cmds(str) ...@@ -762,10 +663,7 @@ function str_cmds(str)
// Interrupt Node // Interrupt Node
if(user.compare_ars("exempt I")) { if(user.compare_ars("exempt I")) {
if(str=="HELP") { help["INTR [#]"] = "Interrupts the specified node, or the current node if none specified";
writeln("INTR [#]");
writeln("\tInterrupts the specified node, or the current node if none specified.");
}
if(word=="INTR") { if(word=="INTR") {
str=str.substr(4); str=str.substr(4);
i=parseInt(get_nodenum(str)); i=parseInt(get_nodenum(str));
...@@ -783,16 +681,14 @@ function str_cmds(str) ...@@ -783,16 +681,14 @@ function str_cmds(str)
// Chat // Chat
if(user.compare_ars("exempt C")) { if(user.compare_ars("exempt C")) {
if(str=="HELP") help["CHAT"] = "Pages the sysop";
writeln("CHAT\tPages the sysop");
if(str=="CHAT") { if(str=="CHAT") {
bbs.page_sysop(); bbs.page_sysop();
return; return;
} }
} }
if(str=="HELP") help["POFF"] = "Toggles if other users can page you for this session";
writeln("POFF\tToggles if other users can page you for this session.");
if(str=="POFF") { if(str=="POFF") {
system.node_list[bbs.node_num-1].misc ^= NODE_POFF; system.node_list[bbs.node_num-1].misc ^= NODE_POFF;
write("Paging is "); write("Paging is ");
...@@ -804,8 +700,7 @@ function str_cmds(str) ...@@ -804,8 +700,7 @@ function str_cmds(str)
// Edit .plan // Edit .plan
if(user.compare_ars("rest not G")) { if(user.compare_ars("rest not G")) {
if(str=="HELP") help["PLAN"] = "Edits or deletes your .plan file (displayed when somebody fingers you)";
writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you).");
if(str=="PLAN") { if(str=="PLAN") {
var plan=format("%suser/%04d.plan",system.data_dir,user.number); var plan=format("%suser/%04d.plan",system.data_dir,user.number);
if(file_exists(plan)) { if(file_exists(plan)) {
...@@ -821,10 +716,8 @@ function str_cmds(str) ...@@ -821,10 +716,8 @@ function str_cmds(str)
} }
} }
if(str=="HELP") { help["SIG"] = "Edit or delete your default message signature";
writeln("SIG\tEdit or delete your default message signature."); help["SUBSIG"] = "Edit or delete your signature for this sub-board (over-rides default)";
writeln("SUBSIG\tEdit or delete your signature for this sub-board (over-rides default).");
}
if(str=="SIG" || str=="SUBSIG") { if(str=="SIG" || str=="SUBSIG") {
var userSigFilename = system.data_dir + "user/" + format("%04u", user.number); var userSigFilename = system.data_dir + "user/" + format("%04u", user.number);
if(str == "SUBSIG") if(str == "SUBSIG")
...@@ -845,10 +738,7 @@ function str_cmds(str) ...@@ -845,10 +738,7 @@ function str_cmds(str)
} }
} }
if(str=="HELP") { help["FIND [word]"] = "Find a message area or file area";
writeln("FIND [word]");
writeln("\tFind a message area or file area.");
}
if(word == "FIND" && node_action == NODE_MAIN) { if(word == "FIND" && node_action == NODE_MAIN) {
str = get_arg(str.substr(4).trim(), "Find").toLowerCase(); str = get_arg(str.substr(4).trim(), "Find").toLowerCase();
if(!str) if(!str)
...@@ -885,12 +775,27 @@ function str_cmds(str) ...@@ -885,12 +775,27 @@ function str_cmds(str)
} }
} }
} }
if(str=="HELP") { help["MSGS"] = "Redisplay instant messages (notifications and telegrams)";
writeln("MSGS\tRedisplay instant messages (notifications and telegrams).");
}
if(word == "MSGS") { if(word == "MSGS") {
load({}, 'viewimsgs.js'); load({}, 'viewimsgs.js');
} }
if(str=="HELP") {
write("\r\n\x01y\x01hAvailable commands\x01n\r\n\r\n");
for(var i in help)
print_help(i, help[i]);
} else if(word == "HELP") {
var cmd = str.substr(4).trim().toUpperCase();
if(!help[cmd])
alert("Unrecognized command: " + cmd);
else
print_help(cmd, help[cmd]);
}
}
function print_help(cmd, desc)
{
console.print(format("\x01h%-18s\x01n ", cmd));
console.putmsg(word_wrap(desc, console.screen_columns - 21), P_INDENT);
} }
//### Generic routine to ask user for parameter if one wasn't specified ### //### Generic routine to ask user for parameter if one wasn't specified ###
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment