-
-
Notifications
You must be signed in to change notification settings - Fork 190
Expand file tree
/
Copy pathspinnerGroup.ts
More file actions
34 lines (30 loc) · 703 Bytes
/
spinnerGroup.ts
File metadata and controls
34 lines (30 loc) · 703 Bytes
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
import * as p from '@clack/prompts';
p.intro('spinner groups start...');
const s = p.spinner();
s.start('example start');
await new Promise((resolve) => setTimeout(resolve, 500));
s.stop('example stopped');
await p.spinnerGroup('Outer group', [
[
'First sub-task',
async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
},
],
[
'Second sub-task',
async () => {
if (process.env.THROW_ERROR) {
throw new Error(process.env.THROW_ERROR);
}
await new Promise((resolve) => setTimeout(resolve, 1000));
},
],
[
'Third sub-task',
async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
},
],
]);
p.outro('spinner group stop...');