Sorted/Auto-Justified the console help command output
Bryan Roe committed
Sep 27, 2019 at 10:30 UTC
327c8481f90a13f0e06a68053b702254be8b9bf4
1 file changed
+17
-1
agents/meshcore.js
+17
-1
@@ -1683,7 +1683,23 @@ function createMeshCore(agent)
1683
var response = null;
1684
switch (cmd) {
1685
case 'help': { // Displays available commands
1686
- response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo, apf.';
1686
+ var fin = '';
1687
+ var f = '';
1688
+ var availcommands = 'help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget, nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi, scanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm, amtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo, apf';
1689
+ availcommands = availcommands.split(',');
1690
+ for (f in availcommands) { availcommands[f] = availcommands[f].trim(); }
1691
+ availcommands = availcommands.sort(); f = '';
1692
+ while (availcommands.length > 0)
1693
+ {
1694
+ if (f.length > 100)
1695
+ {
1696
+ fin += (f + ',\r\n');
1697
+ f = '';
1698
+ }
1699
+ f += (((f != '') ? ', ' : ' ') + availcommands.shift().trim());
1700
+ }
1701
+ if (f != '') { fin += f; }
1702
+ response = 'Available commands: \r\n ' + fin.trim() + '.';
1703
break;
1704
}
1705
/*