1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.Spinner = void 0;
|
11 | const ora = require("ora");
|
12 | const color_1 = require("./color");
|
13 | class Spinner {
|
14 | constructor(text) {
|
15 |
|
16 | this.enabled = true;
|
17 | this.spinner = ora({
|
18 | text,
|
19 |
|
20 |
|
21 | hideCursor: false,
|
22 | discardStdin: false,
|
23 | });
|
24 | }
|
25 | set text(text) {
|
26 | this.spinner.text = text;
|
27 | }
|
28 | succeed(text) {
|
29 | if (this.enabled) {
|
30 | this.spinner.succeed(text);
|
31 | }
|
32 | }
|
33 | info(text) {
|
34 | this.spinner.info(text);
|
35 | }
|
36 | fail(text) {
|
37 | this.spinner.fail(text && color_1.colors.redBright(text));
|
38 | }
|
39 | warn(text) {
|
40 | this.spinner.fail(text && color_1.colors.yellowBright(text));
|
41 | }
|
42 | stop() {
|
43 | this.spinner.stop();
|
44 | }
|
45 | start(text) {
|
46 | if (this.enabled) {
|
47 | this.spinner.start(text);
|
48 | }
|
49 | }
|
50 | }
|
51 | exports.Spinner = Spinner;
|