Skip to content

Commit 2af2d14

Browse files
committed
warn about cli 3
1 parent 0c94809 commit 2af2d14

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

bin/vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
#!/usr/bin/env node
22

3-
require('commander')
3+
const chalk = require('chalk')
4+
const program = require('commander')
5+
6+
program
47
.version(require('../package').version)
58
.usage('<command> [options]')
69
.command('init', 'generate a new project from a template')
710
.command('list', 'list available official templates')
811
.command('build', 'prototype a new project')
9-
.parse(process.argv)
12+
13+
// output help information on unknown commands
14+
program
15+
.arguments('<command>')
16+
.action((cmd) => {
17+
console.log()
18+
console.log(` ` + chalk.red(`Unknown command ${chalk.yellow(cmd)}.`))
19+
if (cmd === 'create') {
20+
console.log(` ` + chalk.cyan(`vue create`) + ' is a Vue CLI 3 only command and you are using Vue CLI 2.x.')
21+
}
22+
console.log()
23+
})
24+
25+
program.parse(process.argv)

0 commit comments

Comments
 (0)