-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
35 lines (27 loc) · 708 Bytes
/
cli.js
File metadata and controls
35 lines (27 loc) · 708 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
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const nodeNvdbClient = require('./');
const cli = meow(`
Usage
$ node-nvdb-client [endpoint] [jsonparams]
Options
--foo Lorem ipsum [Default: false]
Examples
$ node-nvdb-client
unicorns & rainbows
$ node-nvdb-client ponies
ponies & rainbows
`);
var nvdb = nodeNvdbClient();
nvdb.connect(function() {
let endpoint = cli.input[0];
let options = JSON.parse(cli.input[1]+'');
console.log(endpoint);
console.log(options);
nvdb.fetch(endpoint, options,
function(data, response) {
// parsed response body as js object
console.log(JSON.stringify(data));
});
});