mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-19 03:06:29 +00:00
Simple progress bar approach
This commit is contained in:
parent
159a586e08
commit
2b992ec233
@ -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) ->
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user