1+ var log = require ( 'loglevel' ) ;
2+
13var cmd = {
24 command : 'version' ,
35 desc : 'show version info' ,
46 builder : {
5- verbose : {
6- alias : 'v' ,
7- type : 'boolean' ,
8- describe : 'More verbose info'
9- }
107 }
118} ;
129
1310cmd . handler = function ( argv ) {
1411 var version = require ( '../../package.json' ) . version ;
15-
16- if ( ! argv . verbose ) {
17- return console . log ( version ) ;
12+ if ( log . getLevel ( ) >= log . levels . INFO ) {
13+ return log . info ( version ) ;
1814 }
1915
2016 var logo = [
@@ -25,18 +21,18 @@ cmd.handler = function(argv) {
2521 '| | __/ __/ |_ (__| (_) | (_| | __/' ,
2622 '|_|\\___|\\___|\\__|\\___|\\___/ \\__,_|\\___| CLI v' + version
2723 ] . join ( '\n' ) ;
28- console . log ( logo ) ;
24+ log . debug ( logo ) ;
2925
3026 var h = require ( '../helper' ) ;
31- console . log ( '\n[Environment]' ) ;
32- console . log ( 'Cache: ' , h . getCacheDir ( ) ) ;
33- console . log ( 'Config:' , h . getConfigFile ( ) ) ;
27+ log . debug ( '\n[Environment]' ) ;
28+ log . debug ( 'Cache: ' , h . getCacheDir ( ) ) ;
29+ log . debug ( 'Config:' , h . getConfigFile ( ) ) ;
3430
3531 var config = require ( '../config' ) ;
3632 var sprintf = require ( 'sprintf-js' ) . sprintf ;
37- console . log ( '\n[Configuration]' ) ;
33+ log . debug ( '\n[Configuration]' ) ;
3834 Object . getOwnPropertyNames ( config ) . sort ( ) . forEach ( function ( k ) {
39- console . log ( sprintf ( '%-16s %s' , k + ':' , config [ k ] ) ) ;
35+ log . debug ( sprintf ( '%-16s %s' , k + ':' , config [ k ] ) ) ;
4036 } ) ;
4137} ;
4238
0 commit comments