Skip to content

Commit c185e5c

Browse files
authored
docs(prompts): Update README (#297)
1 parent 9a09318 commit c185e5c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

packages/prompts/README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,23 @@ s.start('Installing via npm');
145145
s.stop('Installed via npm');
146146
```
147147

148+
### Progress
149+
150+
The progress component extends the spinner component to add a progress bar to visualize the progression of an action.
151+
152+
```js
153+
import { progress } from '@clack/prompts';
154+
155+
const p = progress({ max: 10 });
156+
p.start('Downloading archive');
157+
// Do download here
158+
p.advance(3, 'Downloading (30%)');
159+
// ...
160+
p.advance(8, 'Downloading (80%)');
161+
// ...
162+
p.stop('Archive downloaded');
163+
```
164+
148165
## Utilities
149166

150167
### Grouping
@@ -226,6 +243,8 @@ stream.error((function *() { yield 'Error!'; })());
226243
stream.message((function *() { yield 'Hello'; yield ", World" })(), { symbol: color.cyan('~') });
227244
```
228245

246+
![clack-log-prompts](https://github.com/bombshell-dev/clack/blob/main/.github/assets/clack-logs.png)
247+
229248
### Task Log
230249

231250
When executing a sub-process or a similar sub-task, `taskLog` can be used to render the output continuously and clear it at the end if it was successful.
@@ -247,5 +266,3 @@ if (success) {
247266
log.error('Failed!');
248267
}
249268
```
250-
251-
![clack-log-prompts](https://github.com/bombshell-dev/clack/blob/main/.github/assets/clack-logs.png)

0 commit comments

Comments
 (0)