-
Notifications
You must be signed in to change notification settings - Fork 0
/
3-basic-example.ts
46 lines (37 loc) · 1.24 KB
/
3-basic-example.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
// 3-basic-example.ts: A basic example demonstrating core functionalities of @reliverse/prompts. Everything in a single file.
import { showSpinner } from "@/reliverse/main-prompts";
import type { OptionalPromptOptions } from "~/types/prod";
import { numberPrompt, textPrompt } from "~/main";
import { errorHandler } from "~/utils/helpers/errors";
export const basicConfig = {
titleColor: "cyanBright",
titleTypography: "bold",
borderColor: "viceGradient",
} satisfies OptionalPromptOptions;
export const extendedConfig = {
...basicConfig,
contentTypography: "italic",
contentColor: "dim",
} satisfies OptionalPromptOptions;
async function main() {
await textPrompt({
id: "start",
title: "Hello, Reliverse Community! 👋",
content: "You are testing the basic example of @reliverse/prompts",
...extendedConfig,
titleVariant: "box",
contentVariant: "underline",
variantOptions: { box: { limit: 50 } },
});
await numberPrompt({
id: "number",
title: "Enter a number",
content: "Type a number between 1 and 100",
...extendedConfig,
titleVariant: "doubleBox",
contentVariant: "underline",
defaultValue: 50,
});
await showSpinner();
}
await main().catch((error) => errorHandler(error));