Commit 64608e3739e0e4e5c1850ebd85a8438cf96e15f7
Make progress bar behave nicely with stdout
Use options.clear to prevent it from running console.log Let it take up the full screen widthCharles Lehner committed on 2/26/2016, 11:10:11 PM
Parent: ddc92710d0eeb04faeb812b67f81828abb16b67d
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -155,17 +155,19 @@ | ||
155 | 155 | return dummyProgress |
156 | 156 | } |
157 | 157 | |
158 | 158 | var numObjects |
159 | - var size = 60 // process.stderr.columns - 5 | |
160 | - var bar = new ProgressBar(':percent :bar', { total: size }) | |
159 | + var size = process.stderr.columns | |
160 | + var bar = new ProgressBar(':percent :bar', { | |
161 | + total: size, | |
162 | + clear: true | |
163 | + }) | |
161 | 164 | |
162 | 165 | var progress = function (readObject) { |
163 | 166 | return function (abort, cb) { |
164 | 167 | readObject(abort, function next(end, object) { |
165 | 168 | if (end === true) { |
166 | - // seems to interfere with stdout | |
167 | - // bar.terminate() | |
169 | + bar.terminate() | |
168 | 170 | } else if (!end) { |
169 | 171 | var name = object.type + ' ' + object.length |
170 | 172 | bar.tick(size / numObjects) |
171 | 173 | } |
Built with git-ssb-web