mirror of https://github.com/embarklabs/embark.git
warn user of typos
This commit is contained in:
parent
1e9439bbe6
commit
c63c9b8728
10
lib/cmd.js
10
lib/cmd.js
|
@ -1,5 +1,6 @@
|
|||
const program = require('commander');
|
||||
const promptly = require('promptly');
|
||||
const propose = require('propose');
|
||||
const Embark = require('../lib/index');
|
||||
let embark = new Embark;
|
||||
|
||||
|
@ -169,8 +170,13 @@ class Cmd {
|
|||
|
||||
otherCommands() {
|
||||
program
|
||||
.action(function (env) {
|
||||
console.log('unknown command "%s"'.red, env);
|
||||
.action(function (cmd) {
|
||||
console.log('unknown command "%s"'.red, cmd);
|
||||
let dictionary = ['new', 'demo', 'build', 'run', 'blockchain', 'simulator', 'test', 'upload', 'version' ];
|
||||
let suggestion = propose(cmd, dictionary, {threshold: 0.3});
|
||||
if (suggestion) {
|
||||
console.log('did you mean "%s"?'.green, suggestion);
|
||||
}
|
||||
console.log("type embark --help to see the available commands");
|
||||
process.exit(0);
|
||||
});
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
"orbit-db": "^0.17.3",
|
||||
"parse-json": "^4.0.0",
|
||||
"promptly": "^2.1.0",
|
||||
"propose": "0.0.5",
|
||||
"serve-static": "^1.11.1",
|
||||
"shelljs": "^0.5.0",
|
||||
"solc": "0.4.17",
|
||||
|
|
Loading…
Reference in New Issue