diff --git a/src/lib/core/plugin.js b/src/lib/core/plugin.js index f1c034218..32cee7e1d 100644 --- a/src/lib/core/plugin.js +++ b/src/lib/core/plugin.js @@ -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'); diff --git a/src/lib/modules/console/index.ts b/src/lib/modules/console/index.ts index f944eae01..241a784ee 100644 --- a/src/lib/modules/console/index.ts +++ b/src/lib/modules/console/index.ts @@ -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);