-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinquirer.js
137 lines (136 loc) · 3.17 KB
/
inquirer.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
const inquirer = require('inquirer');
module.exports = {
askAccount: () => {
const questions = [
{
type: 'confirm',
name: 'account',
message: 'Do you have an account you want to use?',
default: false
}
];
return inquirer.prompt(questions);
},
askSquabbleCredentials: () => {
const questions = [
{
name: 'email',
type: 'input',
message: 'Enter your Squabble.me e-mail address:',
validate: function( value ) {
if (value.length) {
return true;
} else {
return 'Please enter your Squabble.me e-mail address:';
}
}
},
{
name: 'password',
type: 'password',
mask: '*',
message: 'Enter your password:',
validate: function(value) {
if (value.length) {
return true;
} else {
return 'Please enter your password.';
}
}
}
];
return inquirer.prompt(questions);
},
askMethod: () => {
const questions = [
{
type: 'list',
name: 'method',
message: "Select whether you'd like to create or find a game.",
choices: ["Find", "Join", "Create"],
default: ['Find']
}
];
return inquirer.prompt(questions);
},
askCode: () => {
const questions = [
{
type: 'input',
name: 'code',
message: 'Enter the code of the game you would like to join.',
validate: function( value ) {
if (value.length) {
return true;
} else {
return 'Please enter the code of the game you would like to join.';
}
}
}
];
return inquirer.prompt(questions);
},
askGameMode: () => {
const questions = [
{
type: 'list',
name: 'gameMode',
message: 'Select the gamemode you want to play:',
choices: ["Blitz", "Squabble Royale"],
default: ['Blitz']
}
];
return inquirer.prompt(questions);
},
askSecurity: () => {
const questions = [
{
type: 'list',
name: 'security',
message: 'Select the lobby security:',
choices: ["Public", "Private"],
default: ['Public']
}
];
return inquirer.prompt(questions);
},
askDisplayName: () => {
const questions = [
{
type: 'input',
name: 'displayName',
message: 'Enter a name for the accounts.',
validate: function( value ) {
if (value.length) {
return true;
} else {
return 'Please enter a name for the accounts.';
}
}
}
];
return inquirer.prompt(questions);
},
askTasks: () => {
const questions = [
{
type: 'number',
name: 'tasks',
message: 'Enter the ammount of tasks you want to run. (1-20)',
validate: function( value ) {
if (value.length) {
if (value >= 1 && value <= 20) {
return true;
} else {
value = ""
return 'Please enter a valid amount of tasks. (1-20)';
}
} else {
return 'Please enter the amount of tasks you want to run. (1-20)';
}
}
}
];
return inquirer.prompt(questions);
},
}