-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·46 lines (38 loc) · 927 Bytes
/
Copy pathcli.js
File metadata and controls
executable file
·46 lines (38 loc) · 927 Bytes
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
#!/usr/bin/env node
'use strict';
const dns = require('dns');
const got = require('got');
const ora = require('ora');
const logUpdate = require('log-update');
const updateNotifier = require('update-notifier');
const pkg = require('./package.json');
updateNotifier({pkg}).notify();
const spinner = ora();
const url = 'http://whatthecommit.com/index.txt';
const arg = process.argv[2];
if (arg === '-h' || arg === '--help') {
console.log(`
Usage: wtf
Your commit is writing checks your merge can't cash.
`);
process.exit(1);
}
dns.lookup('whatthecommit.com', err => {
if (err) {
logUpdate(`\n› No fucking internet connection!\n`);
process.exit(1);
} else {
logUpdate();
spinner.text = 'What the actual fuck?';
spinner.start();
}
});
got(url).then(res => {
logUpdate(`\n›› ${res.body}`);
spinner.stop();
}).catch(err => {
if (err) {
logUpdate(`\n› Motherfuck! \n`);
process.exit(1);
}
});