-
Notifications
You must be signed in to change notification settings - Fork 0
/
starter.js
45 lines (39 loc) · 1008 Bytes
/
starter.js
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
// https://www.npmjs.com/package/prompts
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'text',
name: 'answer', // name of key response['guess']
message: 'Ask your question here...' // what the user sees in the console
});
// The input gets returned in the response const
console.log('Response', response);
// Which can also be accessed by
console.log(response.answer);
})();
// === Multiple Questions ===
// const questions = [
// {
// type: 'text',
// name: 'username',
// message: 'What is your GitHub username?'
// },
// {
// type: 'number',
// name: 'age',
// message: 'How old are you?'
// },
// {
// type: 'text',
// name: 'about',
// message: 'Tell something about yourself',
// initial: 'Why should I?'
// }
// ];
// (async () => {
// const response = await prompts(questions);
// response => {
// username, age, about;
// };
// console.log(response);
// })();