You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates the API for stopping spinners and progress bars to be clearer
6
+
7
+
Previously, both the spinner and progress bar components used a single `stop` method that accepted a code to indicate success, cancellation, or error. This update separates these into distinct methods: `stop()`, `cancel()`, and `error()`:
8
+
9
+
```diff
10
+
const spinner = prompts.spinner();
11
+
spinner.start();
12
+
13
+
// Cancelling a spinner
14
+
- spinner.stop(undefined, 1);
15
+
+ spinner.cancel();
16
+
17
+
// Stopping with an error
18
+
- spinner.stop(undefined, 2);
19
+
+ spinner.error();
20
+
```
21
+
22
+
As before, you can pass a message to each method to customize the output displayed:
23
+
24
+
```js
25
+
spinner.cancel("Operation cancelled by user");
26
+
progressBar.error("An error occurred during processing");
0 commit comments