You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+28
Original file line number
Diff line number
Diff line change
@@ -134,6 +134,7 @@ Some commands such as `disco` return a setInterval ID. This allows you to stop a
134
134
135
135
```
136
136
var bb8 = require('bb8-commander');
137
+
var appRootPath = require('app-root-path');
137
138
138
139
// Used to create a .bb8config file within your users home directory.
139
140
bb8.setup();
@@ -151,6 +152,33 @@ var id = bb8.executeCommand('disco');
151
152
152
153
// Used to cancel the disco command.
153
154
clearInterval(id);
155
+
156
+
157
+
// Used to execute a custom command you have created.
158
+
var filePath = appRootPath + '/path/to/custom/command';
159
+
bb8.executeCustomCommand(filePath, options)
160
+
161
+
```
162
+
163
+
You can write custom command which can be executed via the executeCustomCommand function. A custom command accepts two parameters, the bb8 instance and any options you wish to pass in.
164
+
165
+
```
166
+
// example custom command
167
+
module.exports = function(bb8, options) {
168
+
bb8.color(options.colour);
169
+
bb8.roll(0, Math.floor(Math.random() * 180));
170
+
}
171
+
```
172
+
173
+
You can then execute this command like this
174
+
175
+
```
176
+
var bb8 = require('bb8-commander');
177
+
var appRootPath = require('app-root-path');
178
+
179
+
// Used to execute a custom command you have created.
180
+
var filePath = appRootPath + '/path/to/custom/command';
0 commit comments