fix issue with repeating console input

This commit is contained in:
Iuri Matias 2018-02-27 19:17:56 -05:00
parent 531af6234b
commit a231f11062
2 changed files with 14 additions and 13 deletions

View File

@ -28,9 +28,6 @@ class Console {
'The web3 object and the interfaces for the deployed contracts and their methods are also available'
];
return helpText.join('\n');
} else if (cmd === 'test') {
this.events.request("console:command", "help", () => {});
return "test";
} else if (['quit', 'exit', 'sair', 'sortir'].indexOf(cmd) >= 0) {
utils.exit();
}

View File

@ -344,23 +344,27 @@ class Dashboard {
self.input.focus();
});
this.input.on('submit', this.executeCmd.bind(this));
this.input.on('submit', this.submitCmd.bind(this));
this.screen.append(this.consoleBox);
}
submitCmd(cmd) {
if (cmd !== '') {
this.history.addCommand(cmd);
this.executeCmd(cmd);
}
this.input.clearValue();
this.input.focus();
}
executeCmd(cmd) {
const self = this;
if (cmd !== '') {
self.history.addCommand(cmd);
self.logText.log('console> '.bold.green + cmd);
self.console.executeCmd(cmd, function (result) {
self.logText.log(result);
});
}
self.input.clearValue();
self.input.focus();
}
}