-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisual-test.js
More file actions
114 lines (103 loc) · 2.79 KB
/
visual-test.js
File metadata and controls
114 lines (103 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import Logion from './index.js';
const logger = new Logion({
spinnerDoneAllChar: '$',
spinnerFormatDone: (str) => str.replace(/-/g, '+'),
});
logger
.text('This will be cleared')
.clear()
.text('JUST TEXT')
.newline()
.text('From a new line')
.separate()
.separate()
.text('Only one separator');
setTimeout(() => {
logger
.newline()
.indent()
.text('With default indent (2)...')
.indent(5)
.text('indent (5) in the middle of a line')
.newline(3)
.newline(2)
.newline(1)
.newline()
.text('After 2 empty lines');
}, 300);
setTimeout(() => {
logger
.newline()
.text(' Success ', 'success')
.text(' Error ', 'error')
.text(' Info ', 'info')
.text(' Bold ', 'bold')
.text(' Underline ', 'underline')
.text(' Italic ', 'italic')
.text(' Strikethrough ', 'strikethrough')
.newline()
.text(' Blue background bold underlined! ', {
bgColor: 'blue',
bold: true,
underline: true,
});
}, 600);
setTimeout(() => {
logger
.newline()
.text('This message will be removed...', 'error', 'remove')
.beep();
}, 900);
setTimeout(() => {
logger
.separate('blue', '~')
.log('Wow, fancy separator!')
.newline()
.text(
logger.style('Yellow italic strikethrough', {
color: 'yellow',
italic: true,
strikethrough: true,
})
)
.line('Whole line with indent (3) and info style', 'info', 3)
.separate()
.newline(2)
.spinner('1', 'First spinner');
}, 1500);
setTimeout(() => {
logger
.spinner('2', 'Second spinner, waw')
.spinner('3', 'Third spinner, yay')
.text('You can log between spinners and style them too')
.spinner('4', logger.style('Colorfull', { color: 'magenta' }), {
color: 'yellow',
indent: 3,
})
.text(
'Very long text will be automatically wrapped on console resize | Very long text will be automatically wrapped on console resize | Very long text will be automatically wrapped on console resize | Very long text will be automatically wrapped on console resize | Very long text will be automatically wrapped on console resize | Very long text will be automatically wrapped on console resize | Very long text will be automatically wrapped on console resize.'
)
.spinner('5', 'This minus will become plus (-)');
}, 2000);
setTimeout(() => {
logger.spinnerDone('1', { text: 'First spinner done! (changed text)' });
}, 1800);
setTimeout(() => {
logger
.spinnerDone('2', {
text: 'Second spinner done! (changed color)',
color: 'blue',
})
.removeLog('remove');
}, 2500);
setTimeout(() => {
logger
.spinnerDone('3', {
text: 'Third spinner done! (changed character)',
char: '%',
})
.spinnerDone('5');
}, 3000);
setTimeout(() => {
process.exit();
}, 4000);