1 | inquirer = require 'inquirer'
|
2 | chalk = require 'chalk'
|
3 |
|
4 | animation = ['/', '–', '\\', '|']
|
5 |
|
6 | spinner = (speed=1) ->
|
7 | ui = new inquirer.ui.BottomBar
|
8 | i = 0
|
9 | ui.updateBottomBar animation[i]
|
10 | interval = setInterval ->
|
11 | i = (i + 1) %% animation.length
|
12 | ui.updateBottomBar animation[i]
|
13 | , 100 // speed
|
14 |
|
15 | ->
|
16 | clearInterval interval
|
17 | ui.updateBottomBar ''
|
18 |
|
19 | log = {}
|
20 | levels =
|
21 | info: 'cyan'
|
22 | success: 'green'
|
23 | warn: 'yellow'
|
24 | error: 'red'
|
25 | for level, color of levels
|
26 | do (level, color) ->
|
27 | log[level] = (args...) -> console.log '\n', (chalk[color] arg for arg in args)..., '\n'
|
28 |
|
29 | module.exports = {log, spinner} |
\ | No newline at end of file |