aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/prompts/prompts.js
blob: bf96ba26e3c00618ae835bcb2dea441ac854bb28 (plain) (blame)
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
import prompt from "prompts";

const questions = [
  {
    type: "text",
    name: "twitter",
    message: `What's your twitter handle?`,
    format: v => `@${v}`,
  },
  {
    type: "number",
    name: "age",
    message: "How old are you?",
    validate: value => (value < 18 ? `Sorry, you have to be 18` : true),
  },
  {
    type: "password",
    name: "secret",
    message: "Tell me a secret",
  },
];

const answers = await prompt(questions);

console.log(answers);