mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 06:33:28 +00:00
Show a spinner if no progress state in os download command
This commit is contained in:
parent
5efa7309be
commit
fa258a84cc
@ -66,11 +66,21 @@
|
||||
}, function(callback) {
|
||||
return mkdirp(path.dirname(options.output), _.unary(callback));
|
||||
}, function(callback) {
|
||||
var bar;
|
||||
var bar, spinner;
|
||||
console.info("Destination file: " + options.output + "\n");
|
||||
bar = new visuals.widgets.Progress('Downloading Device OS');
|
||||
return resin.models.os.download(osParams, options.output, callback, function(state) {
|
||||
return bar.update(state);
|
||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)');
|
||||
return resin.models.os.download(osParams, options.output, function(error) {
|
||||
spinner.stop();
|
||||
if (error != null) {
|
||||
return callback(error);
|
||||
}
|
||||
}, function(state) {
|
||||
if (state != null) {
|
||||
return bar.update(state);
|
||||
} else {
|
||||
return spinner.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
], function(error) {
|
||||
|
@ -76,9 +76,16 @@ exports.download =
|
||||
console.info("Destination file: #{options.output}\n")
|
||||
|
||||
bar = new visuals.widgets.Progress('Downloading Device OS')
|
||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)')
|
||||
|
||||
resin.models.os.download osParams, options.output, callback, (state) ->
|
||||
bar.update(state)
|
||||
resin.models.os.download osParams, options.output, (error) ->
|
||||
spinner.stop()
|
||||
return callback(error) if error?
|
||||
, (state) ->
|
||||
if state?
|
||||
bar.update(state)
|
||||
else
|
||||
spinner.start()
|
||||
|
||||
], (error) ->
|
||||
return done(error) if error?
|
||||
|
@ -61,8 +61,8 @@
|
||||
"npm": "^2.6.1",
|
||||
"open": "0.0.5",
|
||||
"progress-stream": "^0.5.0",
|
||||
"resin-cli-visuals": "^0.0.8",
|
||||
"resin-sdk": "^0.0.2",
|
||||
"resin-cli-visuals": "^0.1.0",
|
||||
"resin-sdk": "^0.0.4",
|
||||
"resin-vcs": "^1.0.0",
|
||||
"underscore.string": "~2.4.0",
|
||||
"update-notifier": "^0.3.1"
|
||||
|
Loading…
Reference in New Issue
Block a user