File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
2
3
- require ( 'commander' )
3
+ const chalk = require ( 'chalk' )
4
+ const program = require ( 'commander' )
5
+
6
+ program
4
7
. version ( require ( '../package' ) . version )
5
8
. usage ( '<command> [options]' )
6
9
. command ( 'init' , 'generate a new project from a template' )
7
10
. command ( 'list' , 'list available official templates' )
8
11
. 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 )
You can’t perform that action at this time.
0 commit comments