diff --git a/lib/cmd.js b/lib/cmd.js index 446c2ee6..af5d8815 100644 --- a/lib/cmd.js +++ b/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); }); diff --git a/package.json b/package.json index d66f4cc0..52dcf8cd 100644 --- a/package.json +++ b/package.json @@ -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",