Adding profile command

This commit is contained in:
Anthony Laibe 2018-07-25 10:15:43 +01:00 committed by Pascal Precht
parent 90e1476888
commit 7268a419c1
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D

View File

@ -3,6 +3,7 @@ const repl = require("repl");
class REPL { class REPL {
constructor(options) { constructor(options) {
this.env = options.env; this.env = options.env;
this.plugins = options.plugins;
} }
start(done) { start(done) {
@ -15,6 +16,19 @@ class REPL {
process.exit(); 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(); done();
} }