Skip to content

Commit 7cc4f2a

Browse files
authored
feat: Add support functions (#5)
1 parent 50aa0a9 commit 7cc4f2a

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

src/content/docs/clack/prompts.mdx

+86
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,92 @@ const shouldProceed = await confirm({
139139
<font color="#06989A">│</font> <font color="#4E9A06">●</font> Yes / ○ No
140140
<font color="#06989A">└</font></pre>
141141

142+
## Support functions
143+
144+
### Intro
145+
146+
```ts twoslash
147+
import { intro } from '@clack/prompts';
148+
149+
intro('Welcome to clack')
150+
```
151+
152+
<pre class="cli-preview"><font color="#555753">┌</font> Welcome to clack</pre>
153+
154+
### Outro
155+
156+
```ts twoslash
157+
import { outro } from '@clack/prompts';
158+
159+
outro('All operations are finished')
160+
```
161+
162+
<pre class="cli-preview"><font color="#555753">│</font>
163+
<font color="#555753">└</font> All operations are finished</pre>
164+
165+
### Note
166+
167+
```ts twoslash
168+
import { note } from '@clack/prompts';
169+
170+
note(
171+
'You can edit the file src/index.jsx',
172+
'Next steps.'
173+
);
174+
```
175+
176+
<pre class="cli-preview"><font color="#555753">│</font>
177+
<font color="#4E9A06">◇</font> Next steps. <font color="#555753">─────────────────────────╮</font>
178+
<font color="#555753">│</font> <font color="#555753">│</font>
179+
<font color="#555753">│</font> You can edit the file src/index.jsx <font color="#555753">│</font>
180+
<font color="#555753">│</font> <font color="#555753">│</font>
181+
<font color="#555753">├───────────────────────────────────────╯</font></pre>
182+
183+
The second parameter (the title) is optional
184+
```ts twoslash
185+
import { note } from '@clack/prompts';
186+
187+
note(
188+
'All files have been created.',
189+
);
190+
```
191+
192+
<pre class="cli-preview"><font color="#555753">│</font>
193+
<font color="#4E9A06">◇</font> <font color="#555753">─────────────────────────────╮</font>
194+
<font color="#555753">│</font> <font color="#555753">│</font>
195+
<font color="#555753">│</font> All files have been created. <font color="#555753">│</font>
196+
<font color="#555753">│</font> <font color="#555753">│</font>
197+
<font color="#555753">├────────────────────────────────╯</font></pre>
198+
199+
### Logs
200+
201+
```ts twoslash
202+
import { log } from '@clack/prompts';
203+
204+
log.step('Check files')
205+
log.info('No files to update')
206+
log.message('Entering directory "src"')
207+
log.error('Permission denied on file src/secret.js')
208+
log.success('Installation complete')
209+
log.warn('Directory is empty, skipping')
210+
log.warning('Directory is empty, skipping')
211+
```
212+
213+
<pre class="cli-preview"><font color="#555753">│</font>
214+
<font color="#4E9A06">◇</font> Check files
215+
<font color="#555753">│</font>
216+
<font color="#3465A4">●</font> No files to update
217+
<font color="#555753">│</font>
218+
<font color="#555753">│</font> Entering directory &quot;src&quot;
219+
<font color="#555753">│</font>
220+
<font color="#CC0000">■</font> Permission denied on file src/secret.js
221+
<font color="#555753">│</font>
222+
<font color="#4E9A06">◆</font> Installation complete
223+
<font color="#555753">│</font>
224+
<font color="#C4A000">▲</font> Directory is empty, skipping
225+
<font color="#555753">│</font>
226+
<font color="#C4A000">▲</font> Directory is empty, skipping</pre>
227+
142228
## Installation
143229

144230
```bash

0 commit comments

Comments
 (0)