more review comments

- remove useless comment
- change use to usage
- better log
This commit is contained in:
Jonathan Rainville 2018-12-14 08:53:49 -05:00
parent 3342c28fae
commit 79fe28d62e
3 changed files with 9 additions and 10 deletions

View File

@ -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');

View File

@ -13,7 +13,7 @@ type MatchFunction = (cmd: string) => boolean;
interface HelpDescription {
matches: string[] | MatchFunction;
description: string;
use?: string;
usage?: string;
}
class Console {
@ -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)"),
@ -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) {
@ -225,7 +224,7 @@ class Console {
const [_cmdName, length] = cmd.split(" ");
this.getHistory(length, callback);
},
use: "history <optionalLength>",
usage: "history <optionalLength>",
});
}

View File

@ -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(' ');
@ -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(' ');
@ -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(' ');