-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·40 lines (33 loc) · 799 Bytes
/
Copy pathcli.js
File metadata and controls
executable file
·40 lines (33 loc) · 799 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
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const chalk = require('chalk');
const updateNotifier = require('update-notifier');
const pkg = require('./package.json');
const quote = require('./index');
const cli = meow(
`
Usage
$ quote [options]
Options
qotd Display quote of the day
Examples
$ quote
To be or not be, that is the question. - William Shakespeare
$ quote qotd
Wars teach us not to love our enemies, but to hate our allies. - W. L. George
`,
{}
);
updateNotifier({ pkg: pkg }).notify();
quote(cli.input[0])
.then((result) => {
console.log(
chalk.cyan(chalk.yellow(result.quote.body) + ' - ' + result.quote.author)
);
process.exit(0);
})
.catch((err) => {
console.log(chalk.bold.red(err));
process.exit(1);
});