@@ -35,25 +35,28 @@ exports.bootstrap = function ({
35
35
36
36
cli
37
37
. version ( pkg . version )
38
+ . help ( )
38
39
39
40
cli
40
41
. command ( 'dev [targetDir]' , 'start development server' )
41
- . option ( '-p, --port < port> ' , 'use specified port (default: 8080)' )
42
- . option ( '-h, --host < host> ' , 'use specified host (default: 0.0.0.0)' )
43
- . option ( '-t, --temp < temp> ' , 'set the directory of the temporary file' )
44
- . option ( '-c, --cache < cache> ' , 'set the directory of cache' )
42
+ . option ( '-p, --port [ port] ' , 'use specified port (default: 8080)' )
43
+ . option ( '-h, --host [ host] ' , 'use specified host (default: 0.0.0.0)' )
44
+ . option ( '-t, --temp [ temp] ' , 'set the directory of the temporary file' )
45
+ . option ( '-c, --cache [ cache] ' , 'set the directory of cache' )
45
46
. option ( '--no-cache' , 'clean the cache before build' )
46
47
. option ( '--debug' , 'start development server in debug mode' )
47
48
. option ( '--silent' , 'start development server in silent mode' )
48
- . action ( ( sourceDir = '.' , {
49
- host,
50
- port,
51
- debug,
52
- temp,
53
- cache,
54
- silent
55
- } ) => {
49
+ . action ( ( sourceDir = '.' , options ) => {
50
+ const {
51
+ host,
52
+ port,
53
+ debug,
54
+ temp,
55
+ cache,
56
+ silent
57
+ } = options
56
58
logger . setOptions ( { logLevel : silent ? 1 : debug ? 4 : 3 } )
59
+ logger . debug ( 'options' , options )
57
60
env . setOptions ( { isDebug : debug , isTest : process . env . NODE_ENV === 'test' } )
58
61
59
62
wrapCommand ( dev ) ( path . resolve ( sourceDir ) , {
@@ -68,20 +71,22 @@ exports.bootstrap = function ({
68
71
69
72
cli
70
73
. command ( 'build [targetDir]' , 'build dir as static site' )
71
- . option ( '-d, --dest < dest> ' , 'specify build output dir (default: .vuepress/dist)' )
72
- . option ( '-t, --temp < temp> ' , 'set the directory of the temporary file' )
73
- . option ( '-c, --cache < cache> ' , 'set the directory of cache' )
74
+ . option ( '-d, --dest [ dest] ' , 'specify build output dir (default: .vuepress/dist)' )
75
+ . option ( '-t, --temp [ temp] ' , 'set the directory of the temporary file' )
76
+ . option ( '-c, --cache [ cache] ' , 'set the directory of cache' )
74
77
. option ( '--no-cache' , 'clean the cache before build' )
75
78
. option ( '--debug' , 'build in development mode for debugging' )
76
79
. option ( '--silent' , 'build static site in silent mode' )
77
- . action ( ( sourceDir = '.' , {
78
- debug,
79
- dest,
80
- temp,
81
- cache,
82
- silent
83
- } ) => {
80
+ . action ( ( sourceDir = '.' , options ) => {
81
+ const {
82
+ debug,
83
+ dest,
84
+ temp,
85
+ cache,
86
+ silent
87
+ } = options
84
88
logger . setOptions ( { logLevel : silent ? 1 : debug ? 4 : 3 } )
89
+ logger . debug ( 'options' , options )
85
90
env . setOptions ( { isDebug : debug , isTest : process . env . NODE_ENV === 'test' } )
86
91
87
92
wrapCommand ( build ) ( path . resolve ( sourceDir ) , {
@@ -103,7 +108,6 @@ exports.bootstrap = function ({
103
108
} )
104
109
105
110
// output help information on unknown commands
106
- // Listen to unknown commands
107
111
cli . on ( 'command:*' , ( ) => {
108
112
console . error ( 'Unknown command: %s' , cli . args . join ( ' ' ) )
109
113
console . log ( )
0 commit comments