You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
681 B
13 lines
681 B
import {QuestionMap} from "inquirer";
|
|
import inquirer from "inquirer";
|
|
|
|
export const prompt = inquirer.prompt;
|
|
export const registerPrompt = inquirer.registerPrompt;
|
|
export const Separator = inquirer.Separator;
|
|
export type InquireFunction<QuestionT extends QuestionMap[keyof QuestionMap], AnswerT extends QuestionT["default"]> = (question: QuestionT) => Promise<AnswerT>
|
|
export type ShowFunction = (text: string) => Promise<void>
|
|
|
|
export async function inquire<QuestionT extends QuestionMap[keyof QuestionMap], AnswerT extends QuestionT["default"]>(question: QuestionT): Promise<AnswerT> {
|
|
const result = await prompt([{...question, name: "answer"}])
|
|
return result.answer
|
|
} |