mirror of https://github.com/embarklabs/embark.git
more review comments
- remove useless comment - change use to usage - better log
This commit is contained in:
parent
3342c28fae
commit
79fe28d62e
|
@ -162,8 +162,8 @@ Plugin.prototype.addContractFile = function(file) {
|
||||||
|
|
||||||
Plugin.prototype.registerConsoleCommand = function(optionsOrCb) {
|
Plugin.prototype.registerConsoleCommand = function(optionsOrCb) {
|
||||||
if (typeof optionsOrCb === 'function') {
|
if (typeof optionsOrCb === 'function') {
|
||||||
this.logger.warn(__('Registering console commands with a function is deprecated'));
|
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
|
// TODO add docs on how to register when they are written
|
||||||
}
|
}
|
||||||
this.console.push(optionsOrCb);
|
this.console.push(optionsOrCb);
|
||||||
this.addPluginType('console');
|
this.addPluginType('console');
|
||||||
|
|
|
@ -13,7 +13,7 @@ type MatchFunction = (cmd: string) => boolean;
|
||||||
interface HelpDescription {
|
interface HelpDescription {
|
||||||
matches: string[] | MatchFunction;
|
matches: string[] | MatchFunction;
|
||||||
description: string;
|
description: string;
|
||||||
use?: string;
|
usage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Console {
|
class Console {
|
||||||
|
@ -107,7 +107,7 @@ class Console {
|
||||||
if (typeof helpDescription.matches === "object") {
|
if (typeof helpDescription.matches === "object") {
|
||||||
matches = helpDescription.matches as string[];
|
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
|
// Add end commands
|
||||||
helpText.push("quit".cyan + " - " + __("to immediatly exit (alias: exit)"),
|
helpText.push("quit".cyan + " - " + __("to immediatly exit (alias: exit)"),
|
||||||
|
@ -128,12 +128,11 @@ class Console {
|
||||||
const plugins = this.plugins.getPluginsProperty("console", "console");
|
const plugins = this.plugins.getPluginsProperty("console", "console");
|
||||||
const helpDescriptions = [];
|
const helpDescriptions = [];
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
// New API
|
|
||||||
if (plugin.description) {
|
if (plugin.description) {
|
||||||
helpDescriptions.push({
|
helpDescriptions.push({
|
||||||
description: plugin.description,
|
description: plugin.description,
|
||||||
matches: plugin.matches,
|
matches: plugin.matches,
|
||||||
use: plugin.use,
|
usage: plugin.usage,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (plugin.matches) {
|
if (plugin.matches) {
|
||||||
|
@ -225,7 +224,7 @@ class Console {
|
||||||
const [_cmdName, length] = cmd.split(" ");
|
const [_cmdName, length] = cmd.split(" ");
|
||||||
this.getHistory(length, callback);
|
this.getHistory(length, callback);
|
||||||
},
|
},
|
||||||
use: "history <optionalLength>",
|
usage: "history <optionalLength>",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ class ENS {
|
||||||
|
|
||||||
registerConsoleCommands() {
|
registerConsoleCommands() {
|
||||||
this.embark.registerConsoleCommand({
|
this.embark.registerConsoleCommand({
|
||||||
use: 'resolve <name>',
|
usage: 'resolve <name>',
|
||||||
description: __('Resolves an ENS name'),
|
description: __('Resolves an ENS name'),
|
||||||
matches: (cmd) => {
|
matches: (cmd) => {
|
||||||
let [cmdName] = cmd.split(' ');
|
let [cmdName] = cmd.split(' ');
|
||||||
|
@ -103,7 +103,7 @@ class ENS {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.embark.registerConsoleCommand({
|
this.embark.registerConsoleCommand({
|
||||||
use: 'lookup <address>',
|
usage: 'lookup <address>',
|
||||||
description: __('Lookup an ENS address'),
|
description: __('Lookup an ENS address'),
|
||||||
matches: (cmd) => {
|
matches: (cmd) => {
|
||||||
let [cmdName] = cmd.split(' ');
|
let [cmdName] = cmd.split(' ');
|
||||||
|
@ -117,7 +117,7 @@ class ENS {
|
||||||
|
|
||||||
|
|
||||||
this.embark.registerConsoleCommand({
|
this.embark.registerConsoleCommand({
|
||||||
use: 'registerSubDomain <subDomain>',
|
usage: 'registerSubDomain <subDomain>',
|
||||||
description: __('Register an ENS sub-domain'),
|
description: __('Register an ENS sub-domain'),
|
||||||
matches: (cmd) => {
|
matches: (cmd) => {
|
||||||
let [cmdName] = cmd.split(' ');
|
let [cmdName] = cmd.split(' ');
|
||||||
|
|
Loading…
Reference in New Issue