@ -204,16 +204,18 @@ Upgrade.process = function (files, skipCount, callback) {
Upgrade . incrementProgress = function ( value ) {
Upgrade . incrementProgress = function ( value ) {
this . current += value || 1 ;
this . current += value || 1 ;
// Redraw the progress bar
// Redraw the progress bar every 100 units
var percentage = 0 ;
if ( this . current % 100 === 0 ) {
var filled = 0 ;
var percentage = 0 ;
var unfilled = 15 ;
var filled = 0 ;
if ( this . total ) {
var unfilled = 15 ;
percentage = Math . floor ( ( this . current / this . total ) * 100 ) + '%' ;
if ( this . total ) {
filled = Math . floor ( ( this . current / this . total ) * 15 ) ;
percentage = Math . floor ( ( this . current / this . total ) * 100 ) + '%' ;
unfilled = Math . max ( 0 , 15 - filled ) ;
filled = Math . floor ( ( this . current / this . total ) * 15 ) ;
}
unfilled = Math . max ( 0 , 15 - filled ) ;
}
readline . cursorTo ( process . stdout , 0 ) ;
readline . cursorTo ( process . stdout , 0 ) ;
process . stdout . write ( ' [' + ( filled ? new Array ( filled ) . join ( '#' ) : '' ) + new Array ( unfilled ) . join ( ' ' ) + '] (' + this . current + '/' + ( this . total || '??' ) + ') ' + percentage + ' ' ) ;
process . stdout . write ( ' [' + ( filled ? new Array ( filled ) . join ( '#' ) : '' ) + new Array ( unfilled ) . join ( ' ' ) + '] (' + this . current + '/' + ( this . total || '??' ) + ') ' + percentage + ' ' ) ;
}
} ;
} ;