-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
75 lines (67 loc) · 1.57 KB
/
index.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const boxen = require("boxen");
const { Confirm, Input, prompt, AutoComplete } = require("enquirer");
const run = async () => {
const response = await prompt([
{
type: "autocomplete",
name: "gender",
message: "What is your gender",
choices: ["male", "female"],
result: function(answer) {
return "Answer is " + answer + something;
}
},
{
type: "autocomplete",
name: "state",
message: "What's your state?",
choices: ["Abia", "Imo"]
}
]);
console.log(response);
return response;
};
// run()
// .then(response => {
// console.log("First response came through as ", response);
// return run();
// })
// .then(response => {
// console.log("Second response came through as ", response);
// });
let answers = [];
const recurse = async counter => {
if (counter >= 5) {
console.log(answers);
return;
}
const response = await prompt({
type: "autocomplete",
choices: ["fine", "not fine"],
name: "you",
message: "how are you?"
});
answers.push(response);
console.log("You answered ", response);
return recurse(counter + 1);
};
recurse(0);
// let name;
// let ask = new Input({
// message: "What's your name?"
// });
// ask
// .run()
// .then(answer => {
// console.log(
// boxen(`Hello ${answer} welcome to Chizo's CLI`, {
// padding: 1,
// margin: 1,
// borderStyle: "double",
// float: "center",
// align: "center",
// borderColor: "cyan"
// })
// );
// })
// .catch(console.log);