File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,10 @@ var GitStats = require("../lib")
99 , GitStatsColors = require ( "git-stats-colors" )
1010 ;
1111
12- // Configure logger
12+ // Configurations
1313Logger . config . displayDate = false ;
1414Logger . config . logLevel = 4 ;
15-
16- // Constants
15+ Moment . suppressDeprecationWarnings = true ;
1716
1817// CLI options
1918switch ( process . argv [ 2 ] ) {
@@ -35,21 +34,27 @@ switch (process.argv[2]) {
3534 console . log ( require ( "../package.json" ) . version ) ;
3635 break ;
3736 default :
38- var options = {
39- start : Moment ( ) . subtract ( 1 , "years" )
40- , end : Moment ( )
41- } ;
37+ var options = { } ;
4238
4339 if ( process . argv . length !== 2 ) {
4440 if ( process . argv [ 2 ] ) {
4541 options . start = Moment ( process . argv [ 2 ] ) ;
42+
4643 }
4744
4845 if ( process . argv [ 3 ] ) {
4946 options . end = Moment ( process . argv [ 3 ] ) ;
5047 }
5148 }
5249
50+ if ( ! options . start || ! options . start . isValid ( ) ) {
51+ options . start = Moment ( ) . subtract ( 1 , "years" ) ;
52+ }
53+
54+ if ( ! options . end || ! options . end . isValid ( ) ) {
55+ options . end = Moment ( ) ;
56+ }
57+
5358 GitStats . ansiCalendar ( options , function ( err , data ) {
5459 if ( err ) { return Logger . log ( err , "error" ) ; }
5560 data = AnsiParser . removeAnsi ( data ) ;
You can’t perform that action at this time.
0 commit comments