forked from mjkaufer/Messer
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
29 lines (25 loc) · 752 Bytes
/
index.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
#!/usr/bin/env node
const parseArgs = require("minimist");
const Messer = require("./src/messer");
const packageJson = require("./package.json");
process.env.ROOT = __dirname;
require("./config");
const COMMANDS = require("./src/commands");
const EVENT_HANDLERS = require("./src/event-handlers");
const messer = new Messer();
COMMANDS.forEach(command => {
messer.registerCommand(command(messer));
});
EVENT_HANDLERS.forEach(handler => {
messer.registerEventHandler(handler(messer));
});
const argv = parseArgs(process.argv.slice(2));
if (argv._ && argv._[0] === "cleanup") {
messer.logout();
} else if (argv.command) {
messer.start(false, argv.command);
} else if (argv.v) {
console.log(packageJson.version);
} else {
messer.start();
}