-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdevsig.js
64 lines (51 loc) · 1.74 KB
/
devsig.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
#!/usr/bin/env node
const chalk = require('chalk');
const pkg = require('./package.json');
const program = require('commander');
const { uptime, verifyUser } = require('./middleware');
const { autostart, editConfig, getReport, fix, listMonitors, startMonitor } = require('./commands');
const { log } = console;
log(chalk.bold.blueBright(`DevSig Agent ${pkg.version}`));
log();
process.on('uncaughtException', (error) => {
log(chalk.redBright(error.message));
log(error);
});
function commaSeparatedList(value, previous) {
return value.split(',');
}
program
.version(pkg.version)
.description('DevSig Agent');
program
.command('start [monitor]')
.option('-a, --apps <apps>', 'list the apps to monitor', commaSeparatedList)
.option('-k, --key-events <events>', 'list the keyboard events to monitor', commaSeparatedList)
.option('-m, --mouse-events <events>', 'list the mouse events to monitor', commaSeparatedList)
.description('Start a monitor or all monitors')
.action(verifyUser)
.action(uptime)
.action(startMonitor);
program
.command('list')
.action(listMonitors);
program
.command('report [reporter]')
.option('-f, --file <name>', 'the name of the file to which the report is to be written')
.option('--logs <logs>', 'list the logs to consider', commaSeparatedList)
.option('--push', 'push the report to the server')
.description('Generate a report')
.action(verifyUser)
.action(getReport);
program
.command('config [field] [value]')
.description('Get or set the value of a config field')
.action(editConfig);
program
.command('autostart <command>')
.action(autostart);
program
.command('fix')
.description('Fixes issues like "Cannot find module \'iohook\'"')
.action(fix);
program.parse(process.argv);