-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
42 lines (38 loc) · 1.29 KB
/
main.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
var program = require('commander');
var prompt_config = require('./scr/prompt/config');
var prompt_run = require('./scr/prompt/run');
var prompt_autorun = require('./scr/prompt/autorun');
var prompt_create = require('./scr/prompt/create');
var prompt_add_test_step = require('./scr/prompt/add_test_step');
program
.version('0.0.2')
.usage('[options] <file ...>')
.option('-c, --config', 'Configuration')
.option(
'-t --test <option>',
'Test option <create|autorun|[test step sys_id]|add-test-step>',
/^(create|autorun|[0-9a-f]{32}|add-test-step)$/i
)
.parse(process.argv);
if (program.config) {
console.log('Please enter your configuration:');
prompt_config();
}
if (program.test) {
switch (true) {
case /[0-9a-f]{32}/.test(program.test):
console.log('Run test ...');
prompt_run(program.test, 'sys_atf_step_' + program.test + '.js');
break;
case /autorun/.test(program.test):
console.log('Autorun active - Listening for file changes ...');
prompt_autorun();
break;
case /create/.test(program.test):
prompt_create();
break;
case /add-test-step/.test(program.test):
prompt_add_test_step();
break;
}
}