Simple progress bar approach

This commit is contained in:
Juan Cruz Viotti 2015-01-29 14:01:21 -04:00
parent 159a586e08
commit 2b992ec233
2 changed files with 6 additions and 6 deletions

View File

@ -4,6 +4,7 @@ async = require('async')
resin = require('resin-sdk')
os = require('os')
visuals = require('resin-cli-visuals')
ProgressBarFormatter = require('progress-bar-formatter')
commandOptions = require('./command-options')
drive = require('../drive/drive')
@ -178,14 +179,12 @@ exports.init =
(confirmed, callback) ->
return done() if not confirmed
progressBar = null
bar = new ProgressBarFormatter()
drive.writeImage params.device, params.image,
progress: not options.quiet
onProgress: (status) ->
console.log(status)
progressBar ?= new visuals.widgets.Progress('Writing device OS', status.length)
progressBar.tick(status.delta)
console.log("#{bar.format(status.percentage / 100)} #{status.percentage}% eta #{status.eta}s")
, callback
], (error) ->

View File

@ -26,9 +26,9 @@
],
"author": "Juan Cruz Viotti <juanchiviotti@gmail.com>",
"license": "MIT",
"optionalDependencies": {
"optionalDependencies": {
"windosu": "^0.1.3"
},
},
"devDependencies": {
"chai": "~1.9.2",
"gulp": "~3.8.9",
@ -55,6 +55,7 @@
"mkdirp": "~0.5.0",
"nplugm": "^1.0.1",
"open": "0.0.5",
"progress-bar-formatter": "^2.0.1",
"progress-stream": "^0.5.0",
"resin-cli-visuals": "0.0.2",
"resin-sdk": "git+https://git@github.com/resin-io/resin-sdk.git",