Added experimental file-search

Bryan Roe committed Nov 9, 2020 at 14:17 UTC dd397bc156f23feef68e29cdb86667fc4e79885f
1 file changed +16
agents/meshcore.js
+16
@@ -2641,6 +2641,22 @@ function createMeshCore(agent) {
2641 response = "Available commands: \r\n" + fin + ".";
2642 break;
2643 }
2644 + case 'find':
2645 + if (args['_'].length <= 1)
2646 + {
2647 + response = "Proper usage:\r\n find root criteria [criteria2] [criteria n...]";
2648 + }
2649 + else
2650 + {
2651 + var root = args['_'][0];
2652 + var p = args['_'].slice(1);
2653 + var r = require('file-search').find(root, p);
2654 + r.sid = sessionid;
2655 + r.on('result', function (str) { sendConsoleText(str, this.sid); });
2656 + r.then(function () { sendConsoleText('*** End Results ***', this.sid); });
2657 + response = "Find: [" + root + "] " + JSON.stringify(p);
2658 + }
2659 + break;
2660 case 'coreinfo': {
2661 response = JSON.stringify(meshCoreObj, null, 2);
2662 break;