@@ -7,6 +7,7 @@ const Config = require('./include/file-config');
77const Cli = require ( './include/cli' ) ;
88const Time = require ( './models/time' ) ;
99const Tasks = require ( './include/tasks' ) ;
10+ const mergeRequest = require ( './models/mergeRequest' ) ;
1011
1112program
1213 . option ( '--verbose' , 'show verbose output' )
@@ -24,6 +25,14 @@ function toHumanReadable(input) {
2425 return Time . toHumanReadable ( Math . ceil ( input ) , config . get ( 'hoursPerDay' ) , timeFormat ) ;
2526}
2627
28+ function column ( str , n ) {
29+ if ( str . length > n ) {
30+ str = str . substr ( 0 , n - 1 ) + "…"
31+ }
32+ return str . padEnd ( n ) ;
33+ } ;
34+
35+
2736tasks . log ( )
2837 . then ( ( { frames, times} ) => {
2938 Object . keys ( frames ) . sort ( ) . forEach ( date => {
@@ -47,9 +56,12 @@ tasks.log()
4756 . sort ( ( a , b ) => a . start . isBefore ( b . start ) ? - 1 : 1 )
4857 . forEach ( frame => {
4958 let toSync = ( Math . ceil ( frame . duration ) - parseInt ( _ . reduce ( frame . notes , ( n , m ) => ( n + m . time ) , 0 ) ) ) != 0 ;
50- let durationText = toSync ? toHumanReadable ( frame . duration ) . yellow : toHumanReadable ( frame . duration ) ;
51- let issue = frame . resource . new ? `new ${ frame . resource . type + ' "' + frame . resource . id . blue } "` : `${ ( frame . resource . type + ' #' + frame . resource . id ) . blue } ` ;
52- console . log ( ` ${ frame . id } ${ frame . start . clone ( ) . format ( 'HH:mm' ) . green } to ${ frame . stop . clone ( ) . format ( 'HH:mm' ) . green } \t${ durationText } \t\t${ frame . project . magenta } \t\t${ issue } \t\t${ frame . note != null ?frame . note :'' } ` )
59+ let durationText = toSync ? toHumanReadable ( frame . duration ) . padEnd ( 14 ) . yellow : toHumanReadable ( frame . duration ) . padEnd ( 14 ) ;
60+ let issue = frame . resource . new ?
61+ column ( `(new ${ frame . resource . type + ' "' + frame . resource . id } ")` , 70 ) . bgBlue :
62+ `${ ( frame . resource . type + ' #' + frame . resource . id ) . padEnd ( 20 ) . blue } ${ column ( frame . title != null ?frame . title :'' , 50 ) } ` ;
63+ console . log ( ` ${ frame . id } ${ frame . start . clone ( ) . format ( 'HH:mm' ) . green } to ${ frame . stop . clone ( ) . format ( 'HH:mm' ) . green } \t${ durationText } ` +
64+ `${ column ( frame . project , 50 ) . magenta } ${ issue } ${ frame . note != null ?frame . note :'' } ` ) ;
5365 } ) ;
5466 } ) ;
5567 }
0 commit comments