Skip to content

Commit

Permalink
change to isArray and fix history with length
Browse files Browse the repository at this point in the history
  • Loading branch information
jrainville committed Dec 14, 2018
1 parent 79fe28d commit ae61792
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/lib/core/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 5 additions & 2 deletions src/lib/modules/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ae61792

Please sign in to comment.