File tree 1 file changed +16
-4
lines changed
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -27,15 +27,27 @@ function runPromise(p) {
27
27
} ) ;
28
28
}
29
29
30
+ function printGitbookVersion ( v ) {
31
+ var actualVersion = ( v . name != v . version ) ? ' (' + v . version + ')' : '' ;
32
+ return v . name + actualVersion ;
33
+ }
30
34
31
35
// Init gitbook-cli
32
36
manager . init ( ) ;
33
37
34
38
program
35
- . version ( pkg . version )
36
39
. option ( '-v, --gitbook [version]' , 'specify GitBook version to use' )
37
- . option ( '-d, --debug' , 'enable verbose error' ) ;
38
-
40
+ . option ( '-d, --debug' , 'enable verbose error' )
41
+ . option ( '-V, --version' , 'Display running versions of gitbook and gitbook-cli' , function ( ) {
42
+ console . log ( 'CLI version:' , pkg . version ) ;
43
+ runPromise (
44
+ manager . ensure ( bookRoot , program . gitbook )
45
+ . then ( function ( v ) {
46
+ console . log ( 'GitBook version:' , printGitbookVersion ( v ) ) ;
47
+ process . exit ( 0 ) ;
48
+ } )
49
+ ) ;
50
+ } ) ;
39
51
40
52
program
41
53
. command ( 'ls' )
@@ -69,7 +81,7 @@ program
69
81
runPromise (
70
82
manager . ensure ( bookRoot , program . gitbook )
71
83
. then ( function ( v ) {
72
- console . log ( 'GitBook version is' , v . name , ( v . name != v . version ? '(' + v . version + ')' : '' ) ) ;
84
+ console . log ( 'GitBook version is' , printGitbookVersion ( v ) ) ;
73
85
} )
74
86
) ;
75
87
} ) ;
You can’t perform that action at this time.
0 commit comments