mirror of https://github.com/embarklabs/embark.git
change to isArray and fix history with length
This commit is contained in:
parent
79fe28d62e
commit
ae61792d5b
|
@ -163,7 +163,6 @@ Plugin.prototype.addContractFile = function(file) {
|
|||
Plugin.prototype.registerConsoleCommand = function(optionsOrCb) {
|
||||
if (typeof optionsOrCb === 'function') {
|
||||
this.logger.warn(__('Registering console commands with function syntax is deprecated and will likely be removed in future versions of Embark.'));
|
||||
// TODO add docs on how to register when they are written
|
||||
}
|
||||
this.console.push(optionsOrCb);
|
||||
this.addPluginType('console');
|
||||
|
|
|
@ -104,7 +104,7 @@ class Console {
|
|||
];
|
||||
helpDescriptions.forEach((helpDescription) => {
|
||||
let matches = [] as string[];
|
||||
if (typeof helpDescription.matches === "object") {
|
||||
if (Array.isArray(helpDescription.matches)) {
|
||||
matches = helpDescription.matches as string[];
|
||||
}
|
||||
helpText.push(`${(helpDescription.usage || matches.join("/")).cyan} - ${helpDescription.description}`);
|
||||
|
@ -219,7 +219,10 @@ class Console {
|
|||
private registerConsoleCommands() {
|
||||
this.embark.registerConsoleCommand({
|
||||
description: __("display console commands history"),
|
||||
matches: ["history"],
|
||||
matches: (cmd: string) => {
|
||||
const [cmdName] = cmd.split(" ");
|
||||
return cmdName === "history";
|
||||
},
|
||||
process: (cmd: string, callback: any) => {
|
||||
const [_cmdName, length] = cmd.split(" ");
|
||||
this.getHistory(length, callback);
|
||||
|
|
Loading…
Reference in New Issue