@@ -20,6 +20,7 @@ exports = module.exports = ProgressBar;
2020 * - `total` total number of ticks to complete
2121 * - `width` the displayed width of the progress bar defaulting to total
2222 * - `stream` the output stream defaulting to stderr
23+ * - `head` head character defaulting to complete character
2324 * - `complete` completion character defaulting to "="
2425 * - `incomplete` incomplete character defaulting to "-"
2526 * - `renderThrottle` minimum time between updates in milliseconds defaulting to 16
@@ -61,7 +62,8 @@ function ProgressBar(fmt, options) {
6162 this . clear = options . clear
6263 this . chars = {
6364 complete : options . complete || '=' ,
64- incomplete : options . incomplete || '-'
65+ incomplete : options . incomplete || '-' ,
66+ head : options . head || ( options . complete || '=' )
6567 } ;
6668 this . renderThrottle = options . renderThrottle !== 0 ? ( options . renderThrottle || 16 ) : 0 ;
6769 this . callback = options . callback || function ( ) { } ;
@@ -153,6 +155,10 @@ ProgressBar.prototype.render = function (tokens) {
153155 complete = Array ( Math . max ( 0 , completeLength + 1 ) ) . join ( this . chars . complete ) ;
154156 incomplete = Array ( Math . max ( 0 , width - completeLength + 1 ) ) . join ( this . chars . incomplete ) ;
155157
158+ /* add head to the complete string */
159+ if ( completeLength > 0 )
160+ complete = complete . slice ( 0 , - 1 ) + this . chars . head ;
161+
156162 /* fill in the actual progress bar */
157163 str = str . replace ( ':bar' , complete + incomplete ) ;
158164
0 commit comments