From 5d5fda54e2279367c08ab6d043d8eb7a5aa954dc Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Wed, 25 Jul 2018 10:15:43 +0100 Subject: [PATCH] Adding profile command --- lib/dashboard/repl.js | 14 ++++++++++++++ lib/index.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) 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 7d22c47ce..3db589bc1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -284,7 +284,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) {