1 | #!/usr/bin/env node
|
2 |
|
3 | 'use strict';
|
4 |
|
5 | const yargs = require('yargs');
|
6 | const krdsLabels = require('../');
|
7 |
|
8 | const argv = yargs
|
9 | .usage('$0 --db [db name] -o [output path] -f [output format]')
|
10 | .example('node $0 --db krds_unity -f kite -o ./application/config/extra')
|
11 | .alias('p', 'db')
|
12 | .alias('p', 'project')
|
13 | .alias('o', 'outpath')
|
14 | .alias('f', 'format')
|
15 | .default('o', '.')
|
16 | .demand('db')
|
17 | .demand('f')
|
18 | .argv;
|
19 |
|
20 | const dbName = argv.db;
|
21 | const opts = {
|
22 | outpath: argv.outpath,
|
23 | format: argv.format
|
24 | }
|
25 |
|
26 | krdsLabels(dbName, opts, (err, status) => {
|
27 | if (err) {
|
28 | console.error(err.stack || err);
|
29 | process.exit(1);
|
30 | } else {
|
31 | console.info(status || 'done');
|
32 | }
|
33 | });
|