-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (24 loc) · 912 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
30
31
#!/usr/bin/env node
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
handleError(`UNHANDLED ERROR`, err);
});
const cli = require('./utils/cli.js');
const Museum = require('./data/museum.js');
const Region = require('./data/region.js');
const [input] = cli.input;
const name = cli.flags.name;
const province = cli.flags.province;
const city = cli.flags.city;
const district = cli.flags.district;
const detail = cli.flags.detail;
const code = cli.flags.code;
(async () => {
input === 'help' && (await cli.showHelp(0));
const data = input === 'data' ? true : false;
const region = input === 'region' ? true : false;
Museum(data, name, province, city, district, detail);
Region(region, code);
})();