-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglnotify-add.js
50 lines (46 loc) · 1.02 KB
/
glnotify-add.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
var watch_list = require('./utils/watch_list.js')
var inquirer = require('inquirer');
var trim = require('trim')
var prompts = [
{
name: 'user',
message: 'Repo Username:',
validate: function (input) {
return input.length > 0
}
},
{
name: 'repo',
message: 'Repo Name:',
validate: function (input) {
return input.length > 0
}
},
{
name: 'labels',
message: 'Labels to watch: (Comma separated)',
validate: function (input) {
return input.length > 0
}
},
{
name: 'add_another',
message: 'Add another repo?',
type: 'confirm'
}
]
function doPrompt() {
inquirer.prompt(prompts).then(function(answers) {
var parsed_labels = answers.labels.split(',');
parsed_labels = parsed_labels.map(function(label){
return trim(label);
});
watch_list.create_entry(answers.user,
answers.repo,
parsed_labels);
if(answers.add_another){
doPrompt();
}
});
}
doPrompt();