-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstandard.ts
More file actions
39 lines (35 loc) · 735 Bytes
/
standard.ts
File metadata and controls
39 lines (35 loc) · 735 Bytes
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
import { prompt } from "inquirer";
const CHOICES = [
{
name: "Option 1",
value: "option1"
},
{
name: "Option 2",
value: "option2"
},
{
name: "Option 3",
value: "option3"
}
];
(async () => {
const { optionChoice, fullName } = await prompt([
{
message: "Which option do you want to choose?",
name: "optionChoice",
type: "checkbox",
choices: CHOICES
},
{
message: "What's your full name?",
name: "fullName",
type: "input"
}
]);
optionChoice.forEach(choice => {
const choiceName = CHOICES.find(({ value }) => value === choice).name;
console.log(`${choiceName} Chosen`);
});
console.log(`Your name is "${fullName}"`);
})();