mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-20 17:33:18 +00:00
Move ProgressBar to ui.widgets
This commit is contained in:
parent
da02857a6e
commit
f04f6f8702
@ -2,8 +2,8 @@ _ = require('lodash')
|
||||
async = require('async')
|
||||
path = require('path')
|
||||
mkdirp = require('mkdirp')
|
||||
ProgressBar = require('progress')
|
||||
resin = require('resin-sdk')
|
||||
ui = require('../ui')
|
||||
|
||||
exports.download =
|
||||
signature: 'os download <id>'
|
||||
@ -81,11 +81,7 @@ exports.download =
|
||||
resin.models.os.download osParams, outputFile, callback, (state) ->
|
||||
|
||||
# TODO: Allow quieting this progress bar
|
||||
bar ?= new ProgressBar 'Downloading device OS [:bar] :percent :etas',
|
||||
complete: '='
|
||||
incomplete: ' '
|
||||
width: 40
|
||||
total: state.total
|
||||
bar ?= new ui.widgets.Progress('Downloading device OS', state.total)
|
||||
|
||||
return if bar.complete or not state?
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
_ = require('lodash')
|
||||
inquirer = require('inquirer')
|
||||
ProgressBar = require('progress')
|
||||
|
||||
exports.table = require('./table/table')
|
||||
|
||||
@ -74,3 +75,14 @@ exports.ask = (question, callback) ->
|
||||
}
|
||||
], (response) ->
|
||||
return callback(null, response.answer)
|
||||
|
||||
exports.Progress = class Progress extends ProgressBar
|
||||
constructor: (message, size) ->
|
||||
message = "#{message} [:bar] :percent :etas"
|
||||
options =
|
||||
complete: '='
|
||||
incomplete: ' '
|
||||
width: 40
|
||||
total: size
|
||||
|
||||
super(message, options)
|
||||
|
Loading…
x
Reference in New Issue
Block a user