-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (33 loc) · 1.09 KB
/
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
32
33
34
35
36
37
38
var commander = require('commander');
var creator = require('./lib/creator');
var path = require('path');
commander
.version('0.0.1')
.option('-d, --sr-dir <dir>', 'Path to SR directory')
.option('-s, --sqlite-db [file]', 'Path to create or re-use sqlite DB')
.option('-r, --reuse-db', 'Re-use (don\'t create) the provided sqlite DB')
.option(
'-f, --fill-tables [tables]', 'Only fill listed tables in the sqlite DB')
.option('-e, --es-export [file]', 'Path to create elasticsearch export')
.option('-m, --mappings-file [file]', 'Path to mappings file')
.parse(process.argv);
var srDir = commander.srDir;
if (!srDir) {
commander.help();
}
var fillTables = commander.fillTables;
if (fillTables) {
fillTables = JSON.parse(fillTables);
}
var mappingsFilePath = commander.mappingsFile;
if (!commander.mappingsFile) {
mappingsFilePath = path.resolve('config/mappings.json');
}
var creator = new creator(srDir);
creator.generate({
dbPath: commander.sqliteDb,
reuseDb: commander.reuseDb,
fillTables: fillTables,
esExportPath: commander.esExport,
mappingsFilePath: mappingsFilePath
});