-
Notifications
You must be signed in to change notification settings - Fork 0
/
enquire.js
63 lines (62 loc) · 1.43 KB
/
enquire.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
const inquirer = require("inquirer");
module.exports = {
askCfCredentials: () => {
const questions = [
{
name: "username",
type: "input",
message: "Enter your Codeforces e-mail address:",
validate: function (value) {
if (value.length) {
return true;
} else {
return "Please enter your username or e-mail address.";
}
},
},
{
name: "password",
type: "password",
message: "Enter your password:",
validate: function (value) {
if (value.length) {
return true;
} else {
return "Please enter your password.";
}
},
},
];
return inquirer.prompt(questions);
},
chooseTags: async (tags) => {
const questions = [
{
type: "checkbox",
name: "tags",
message: "Select Tags",
choices: tags,
},
];
let res = [];
await inquirer.prompt(questions).then((answers) => {
res = answers.tags;
});
return res;
},
chooseProblem: async (problems) => {
const questions = [
{
type: "list",
name: "problems",
message: "Choose a problem to view",
choices: problems,
},
];
let chosenProblem = "";
await inquirer.prompt(questions).then((answers) => {
chosenProblem = answers.problems;
});
return chosenProblem;
},
};