|
@@ -9,7 +9,7 @@ This is not an intention to replace nodejs modules but a way to swap certain are
|
|
|
Usage:
|
|
|
-------
|
|
|
Bundle:
|
|
|
-A bundle should export bundleStart, or bundleActivator object
|
|
|
+A bundle should export bundleStart, or bundleActivator object with start and stop methods
|
|
|
|
|
|
This specific bundle it will receive messages from core-shell bundle, execute a shell command and print output
|
|
|
Placing the bundle in {app path}/bundles/shell-test/index.js
|
|
@@ -18,13 +18,11 @@ var log = require('hlogger').createLogger('shell-test');
|
|
|
var child = require('child_process');
|
|
|
|
|
|
function bundleStart(context) {
|
|
|
-
|
|
|
- log.info("Command provider installed");
|
|
|
-
|
|
|
+ log.info('Command provider installed');
|
|
|
// Create a bash and transport commands
|
|
|
context.events
|
|
|
.channel('core-shell')
|
|
|
- .after('cmd',(req,res,e) => {
|
|
|
+ .after('cmd',(req,res,e) => { // Subscribe for core-shell cmd messages, after means it will let execute any preexisting shell and if not found it will execute this
|
|
|
if(e.count != 0) return;
|
|
|
e.wait();
|
|
|
var shcmd = req.cmd + " " + req.args.join(" ");
|
|
@@ -46,6 +44,9 @@ var BundleManager = require('node-hci'); // or path to node-hci since is not p
|
|
|
var manager = new BundleManager({runPath: __dirname + "/bundles"});
|
|
|
manager.loadDefaultBundles();
|
|
|
```
|
|
|
+Result of this bundle:
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|