Skip to content

Commit 29f345c

Browse files
committed
Added spinner
1 parent 946ad81 commit 29f345c

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
],
3030
"license": "GPL-3.0",
3131
"dependencies": {
32+
"cli-spinner": "^0.2.4",
3233
"commander": "^2.8.1",
3334
"debug": "^2.2.0",
3435
"faye": "^1.1.2",

src/controller.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ var util = require('util'),
1818
frame = require('./frame'),
1919
user = require('./user'),
2020
rest = require('./rest'),
21+
Spinner = require('cli-spinner').Spinner,
22+
spinner = new Spinner('[%s]'),
2123

2224
// --> EXPORT
2325
fc = module.exports = {};
@@ -37,6 +39,10 @@ util.inherits(fc, EventEmitter);
3739
fc.init = function() {
3840
debug('init');
3941

42+
console.log('\n');
43+
spinner.setSpinnerString(1);
44+
spinner.start();
45+
4046
this.login()
4147
.then(this.connect)
4248
.then(this.ready)
@@ -79,7 +85,6 @@ fc.installPlugin = function(plugin) {
7985
})
8086
.catch(function(err) {
8187
if (err.status === 404) {
82-
console.log('\n');
8388
console.log('[o] ERROR: This frame has been set up perviously, but is not attached this user.');
8489
console.log('\n');
8590
console.log('To reset the frame entirely, restart using: openframe -r');
@@ -123,7 +128,6 @@ fc.uninstallPlugin = function(packageName) {
123128
})
124129
.catch(function(err) {
125130
if (err.status === 404) {
126-
console.log('\n');
127131
console.log('[o] ERROR: This frame has been set up perviously, but is not attached this user.');
128132
console.log('\n');
129133
console.log('To reset the frame entirely, restart using: openframe -r');
@@ -137,6 +141,7 @@ fc.uninstallPlugin = function(packageName) {
137141
*/
138142
fc.ready = function() {
139143
debug('ready');
144+
spinner.stop(true);
140145

141146
if (frame.state && frame.state._current_artwork) {
142147
fc.changeArtwork();
@@ -145,8 +150,8 @@ fc.ready = function() {
145150
var url_port = config.ofrc.network.api_url.split(':');
146151
var url = url_port[2] === '80' ? url_port[0] + url_port[1] : config.ofrc.network.api_url;
147152

153+
148154
// No current artwork... give the user a message:
149-
console.log('\n');
150155
console.log('[o] Frame connected!');
151156
console.log('\n');
152157
console.log('This frame should now appear as ' + frame.state.name + ' when you log in to Openframe at ' + url + '.');

0 commit comments

Comments
 (0)