-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.ts
47 lines (38 loc) · 1.55 KB
/
index.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
47
// Import Internal Dependencies
import * as prompts from "./src/prompts/index.js";
import { required, type PromptValidator } from "./src/validators.js";
import { PromptAgent } from "./src/prompt-agent.js";
import type { AbstractPromptOptions } from "./src/prompts/abstract.js";
import type { Choice } from "./src/types.js";
import type { QuestionOptions } from "./src/prompts/question.js";
import type { ConfirmOptions } from "./src/prompts/confirm.js";
import type { MultiselectOptions } from "./src/prompts/multiselect.js";
import type { SelectOptions } from "./src/prompts/select.js";
export async function question(message: string, options: Omit<QuestionOptions, "message"> = {}) {
return new prompts.QuestionPrompt({ ...options, message }).question();
}
export async function select(message: string, options: Omit<SelectOptions, "message">) {
const selectPrompt = new prompts.SelectPrompt({ ...options, message });
return selectPrompt.select();
}
export async function confirm(message: string, options: Omit<ConfirmOptions, "message"> = {}) {
const confirmPrompt = new prompts.ConfirmPrompt({ ...options, message });
return confirmPrompt.confirm();
}
export async function multiselect(message: string, options: Omit<MultiselectOptions, "message">) {
const multiselectPrompt = new prompts.MultiselectPrompt({ ...options, message });
return multiselectPrompt.multiselect();
}
export type {
PromptValidator,
AbstractPromptOptions,
QuestionOptions,
ConfirmOptions,
Choice,
MultiselectOptions,
SelectOptions
};
export {
required,
PromptAgent
};