@@ -19,6 +19,7 @@ exports = module.exports = ProgressBar;
1919 * - `total` total number of ticks to complete
2020 * - `width` the displayed width of the progress bar defaulting to total
2121 * - `stream` the output stream defaulting to stderr
22+ * - `head` head character defaulting to complete character
2223 * - `complete` completion character defaulting to "="
2324 * - `incomplete` incomplete character defaulting to "-"
2425 * - `renderThrottle` minimum time between updates in milliseconds defaulting to 16
@@ -59,7 +60,8 @@ function ProgressBar(fmt, options) {
5960 this . clear = options . clear
6061 this . chars = {
6162 complete : options . complete || '=' ,
62- incomplete : options . incomplete || '-'
63+ incomplete : options . incomplete || '-' ,
64+ head : options . head || ( options . complete || '=' )
6365 } ;
6466 this . renderThrottle = options . renderThrottle !== 0 ? ( options . renderThrottle || 16 ) : 0 ;
6567 this . callback = options . callback || function ( ) { } ;
@@ -145,6 +147,10 @@ ProgressBar.prototype.render = function (tokens) {
145147 complete = Array ( completeLength + 1 ) . join ( this . chars . complete ) ;
146148 incomplete = Array ( width - completeLength + 1 ) . join ( this . chars . incomplete ) ;
147149
150+ /* add head to the complete string */
151+ if ( completeLength > 0 )
152+ complete = complete . slice ( 0 , - 1 ) + this . chars . head ;
153+
148154 /* fill in the actual progress bar */
149155 str = str . replace ( ':bar' , complete + incomplete ) ;
150156
0 commit comments