Skip to content

Commit

Permalink
more review comments
Browse files Browse the repository at this point in the history
- remove useless comment
- change use to usage
- better log
  • Loading branch information
jrainville committed Dec 14, 2018
1 parent 3342c28 commit 79fe28d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/lib/core/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ Plugin.prototype.addContractFile = function(file) {

Plugin.prototype.registerConsoleCommand = function(optionsOrCb) {
if (typeof optionsOrCb === 'function') {
this.logger.warn(__('Registering console commands with a function is deprecated'));
// TODO add docs on how to register
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
9 changes: 4 additions & 5 deletions src/lib/modules/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type MatchFunction = (cmd: string) => boolean;
interface HelpDescription {
matches: string[] | MatchFunction;
description: string;
use?: string;
usage?: string;
}

class Console {
Expand Down Expand Up @@ -107,7 +107,7 @@ class Console {
if (typeof helpDescription.matches === "object") {
matches = helpDescription.matches as string[];
}
helpText.push(`${(helpDescription.use || matches.join("/")).cyan} - ${helpDescription.description}`);
helpText.push(`${(helpDescription.usage || matches.join("/")).cyan} - ${helpDescription.description}`);
});
// Add end commands
helpText.push("quit".cyan + " - " + __("to immediatly exit (alias: exit)"),
Expand All @@ -128,12 +128,11 @@ class Console {
const plugins = this.plugins.getPluginsProperty("console", "console");
const helpDescriptions = [];
for (const plugin of plugins) {
// New API
if (plugin.description) {
helpDescriptions.push({
description: plugin.description,
matches: plugin.matches,
use: plugin.use,
usage: plugin.usage,
});
}
if (plugin.matches) {
Expand Down Expand Up @@ -225,7 +224,7 @@ class Console {
const [_cmdName, length] = cmd.split(" ");
this.getHistory(length, callback);
},
use: "history <optionalLength>",
usage: "history <optionalLength>",
});
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib/modules/ens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ENS {

registerConsoleCommands() {
this.embark.registerConsoleCommand({
use: 'resolve <name>',
usage: 'resolve <name>',
description: __('Resolves an ENS name'),
matches: (cmd) => {
let [cmdName] = cmd.split(' ');
Expand All @@ -103,7 +103,7 @@ class ENS {
});

this.embark.registerConsoleCommand({
use: 'lookup <address>',
usage: 'lookup <address>',
description: __('Lookup an ENS address'),
matches: (cmd) => {
let [cmdName] = cmd.split(' ');
Expand All @@ -117,7 +117,7 @@ class ENS {


this.embark.registerConsoleCommand({
use: 'registerSubDomain <subDomain>',
usage: 'registerSubDomain <subDomain>',
description: __('Register an ENS sub-domain'),
matches: (cmd) => {
let [cmdName] = cmd.split(' ');
Expand Down

0 comments on commit 79fe28d

Please sign in to comment.