Skip to content

Commit f160bad

Browse files
chore: iterate through all the available commands and find closest match
1 parent 4f84d20 commit f160bad

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/@vue/cli/bin/vue.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,15 @@ if (!process.argv.slice(2).length) {
257257

258258
function suggestCommands (unknownCommand) {
259259
const availableCommands = program.commands.map(cmd => cmd._name)
260-
261-
const suggestion = availableCommands.find(cmd => {
262-
return leven(cmd, unknownCommand) < 3
260+
261+
let suggestion
262+
263+
availableCommands.forEach(cmd => {
264+
if (leven(cmd, unknownCommand) < 3) {
265+
suggestion = cmd
266+
}
263267
})
268+
264269
if (suggestion) {
265270
console.log(` ` + chalk.red(`Did you mean ${chalk.yellow(suggestion)}?`))
266271
}

0 commit comments

Comments
 (0)