-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (43 loc) · 1.21 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
/**
* Utkarsh
* Automation
*
* @author Utkarsh Tripathi <https://utkarsh.ninja>
*/
const init = require('./utils/init');
const cli = require('./utils/cli');
const log = require('./utils/log');
const input = cli.input;
const flags = cli.flags;
const { clear, debug } = flags;
const chalk = require('chalk');
const { showJoke } = require('./utils/custom/joke');
const chat = require('./utils/custom/chat');
const ping = require('./utils/custom/ping');
const { generator } = require('./utils/custom/generator');
(async () => {
try {
init({ clear });
if (input.length === 0) {
process.exit(0);
} else if (input.length === 1 && input.includes(`help`)) {
cli.showHelp(0);
} else if (input.length === 1 && input.includes(`joke`)) {
showJoke(flags.joke, flags.alljoke);
} else if (input.length === 1 && input.includes(`chat`)) {
chat(flags.username, flags.room, flags.color);
} else if (input.length === 1 && input.includes(`ping`)) {
ping();
} else if (input.length === 1 && input.includes(`generator`)) {
generator();
} else {
console.log(chalk.red('Invalid command'));
process.exit(0);
}
debug && log(flags);
} catch (e) {
console.log(e);
process.exit(0);
}
})();