diff --git a/lib/dashboard/repl.js b/lib/dashboard/repl.js index d9a0dd014..28129bed9 100644 --- a/lib/dashboard/repl.js +++ b/lib/dashboard/repl.js @@ -3,6 +3,7 @@ const repl = require("repl"); class REPL { constructor(options) { this.env = options.env; + this.plugins = options.plugins; } start(done) { @@ -15,6 +16,19 @@ class REPL { process.exit(); }); + let self = this; + this.replServer.defineCommand('profile', { + help: 'Profile a contract', + action(contract) { + this.clearBufferedCommand(); + let pluginCmds = self.plugins.getPluginsProperty('console', 'console'); + for (let pluginCmd of pluginCmds) { + pluginCmd.call(self, `profile ${contract}`, {}); + } + this.displayPrompt(); + } + }); + done(); } diff --git a/lib/index.js b/lib/index.js index 2bb4c0ec6..496c1d2a2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -281,7 +281,7 @@ class Embark { }); }, function startREPL(callback) { - let repl = new REPL({env: engine.env}); + let repl = new REPL({env: engine.env, plugins: engine.plugins}); repl.start(callback); } ], function (err, _result) {