diff --git a/src/lib/modules/console/index.ts b/src/lib/modules/console/index.ts index b0f36e823..802b45cd6 100644 --- a/src/lib/modules/console/index.ts +++ b/src/lib/modules/console/index.ts @@ -78,8 +78,6 @@ class Console { __("Welcome to Embark") + " " + this.version, "", __("possible commands are:"), - "versions - " + __("display versions in use for libraries and tools like web3 and solc"), - "history - " + __("display console commands history"), // TODO: only if the blockchain is actually active! // will need to pass te current embark state here "ipfs - " + __("instantiated js-ipfs object configured to the current environment (available if ipfs is enabled)"), @@ -205,12 +203,13 @@ class Console { } private registerConsoleCommands() { - this.embark.registerConsoleCommand((cmd: string, options?: any) => { - const [cmdName, length] = cmd.split(" "); - return { - match: () => cmdName === "history", - process: (callback: any) => this.getHistory(length, callback), - }; + this.embark.registerConsoleCommand({ + description: __("display console commands history"), + matches: ["history"], + use: "history ", + }, (cmd: string, callback: any) => { + const [_cmdName, length] = cmd.split(" "); + this.getHistory(length, callback); }); } diff --git a/src/lib/modules/ens/index.js b/src/lib/modules/ens/index.js index 4d0254f3a..99a394240 100644 --- a/src/lib/modules/ens/index.js +++ b/src/lib/modules/ens/index.js @@ -89,28 +89,41 @@ class ENS { } registerConsoleCommands() { - this.embark.registerConsoleCommand((cmd, _options) => { - let [cmdName, domain] = cmd.split(' '); - return { - match: () => cmdName === 'resolve', - process: (cb) => global.EmbarkJS.Names.resolve(domain, cb) - }; + this.embark.registerConsoleCommand({ + use: 'resolve ', + description: __('Resolves an ENS name'), + matches: (cmd) => { + let [cmdName] = cmd.split(' '); + return cmdName === 'resolve'; + } + }, (cmd, cb) => { + let [_cmdName, domain] = cmd.split(' '); + global.EmbarkJS.Names.resolve(domain, cb); }); - this.embark.registerConsoleCommand((cmd, _options) => { - let [cmdName, address] = cmd.split(' '); - return { - match: () => cmdName === 'lookup', - process: (cb) => global.EmbarkJS.Names.lookup(address, cb) - }; + this.embark.registerConsoleCommand({ + use: 'lookup
', + description: __('Lookup an ENS address'), + matches: (cmd) => { + let [cmdName] = cmd.split(' '); + return cmdName === 'lookup'; + } + }, (cmd, cb) => { + let [_cmdName, address] = cmd.split(' '); + global.EmbarkJS.Names.lookup(address, cb); }); - this.embark.registerConsoleCommand((cmd, _options) => { - let [cmdName, name, address] = cmd.split(' '); - return { - match: () => cmdName === 'registerSubDomain', - process: (cb) => global.EmbarkJS.Names.registerSubDomain(name, address, cb) - }; + + this.embark.registerConsoleCommand({ + use: 'registerSubDomain ', + description: __('Register an ENS sub-domain'), + matches: (cmd) => { + let [cmdName] = cmd.split(' '); + return cmdName === 'registerSubDomain'; + } + }, (cmd, cb) => { + let [_cmdName, name, address] = cmd.split(' '); + global.EmbarkJS.Names.registerSubDomain(name, address, cb); }); } diff --git a/src/lib/modules/library_manager/index.js b/src/lib/modules/library_manager/index.js index 67cde3ba4..d65cd3d50 100644 --- a/src/lib/modules/library_manager/index.js +++ b/src/lib/modules/library_manager/index.js @@ -39,17 +39,19 @@ class LibraryManager { registerCommands() { const self = this; - this.embark.registerConsoleCommand((cmd, _options) => { - return { - match: () => cmd === "versions" || cmd === __('versions'), - process: (callback) => { - let text = [__('versions in use') + ':']; - for (let lib in self.versions) { - text.push(lib + ": " + self.versions[lib]); - } - callback(null, text.join('\n')); - } - }; + const matches = ['versions']; + if (__('versions') !== matches[0]) { + matches.push(__('versions')); + } + this.embark.registerConsoleCommand({ + matches, + description: __("display versions in use for libraries and tools like web3 and solc") + }, (cmd, callback) => { + let text = [__('versions in use') + ':']; + for (let lib in self.versions) { + text.push(lib + ": " + self.versions[lib]); + } + callback(null, text.join('\n')); }); }