mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
fix: array tags did not propagate
This commit is contained in:
35
src/cli.ts
35
src/cli.ts
@@ -85,15 +85,18 @@ commander
|
||||
});
|
||||
|
||||
commander
|
||||
.command('mapping <srcPath> <destPath> [ignoredTags]')
|
||||
.action(async (relativeSrcPath, relativeMappingPath, ignoredTags) => {
|
||||
.command('mapping <relativeSrcPath>')
|
||||
.option('-m, --mappingPath <relativeMappingPath>', 'Mapping Path')
|
||||
.option('-i, --ignoredTags <ignoredTags>', 'Ignored Tags')
|
||||
.option('-a, --aggPath <relativeAggregationPath>', 'Aggregations Path')
|
||||
.option('-e, --errorPath <relativeErrorPath>', 'Error Path')
|
||||
.action(async (relativeSrcPath, options) => {
|
||||
// get absolute paths
|
||||
const srcPath = resolve(relativeSrcPath);
|
||||
const mappingPath = resolve(relativeMappingPath);
|
||||
|
||||
let ignoredTagsList: string[] = [];
|
||||
if (typeof ignoredTags === 'string') {
|
||||
ignoredTagsList = ignoredTags.split(',');
|
||||
if (typeof options.ignoredTags === 'string') {
|
||||
ignoredTagsList = options.ignoredTags.split(',');
|
||||
}
|
||||
|
||||
// get project reflection
|
||||
@@ -107,10 +110,24 @@ commander
|
||||
}
|
||||
|
||||
// write documentation to file
|
||||
// tslint:disable-next-line:no-magic-numbers
|
||||
writeFileSync(mappingPath, JSON.stringify(result.mappings, null, 2));
|
||||
|
||||
Logger.ok(`Elasticsearch mapping written to ${mappingPath}.`);
|
||||
if (typeof options.aggPath !== 'undefined') {
|
||||
const aggPath = resolve(options.aggPath);
|
||||
// tslint:disable-next-line:no-magic-numbers
|
||||
writeFileSync(aggPath, JSON.stringify(result.aggregations, null, 2));
|
||||
Logger.ok(`Elasticsearch aggregations written to ${aggPath}.`);
|
||||
}
|
||||
if (typeof options.mappingPath !== 'undefined') {
|
||||
const mappingPath = resolve(options.mappingPath);
|
||||
// tslint:disable-next-line:no-magic-numbers
|
||||
writeFileSync(mappingPath, JSON.stringify(result.mappings, null, 2));
|
||||
Logger.ok(`Elasticsearch mappings written to ${mappingPath}.`);
|
||||
}
|
||||
if (typeof options.errorPath !== 'undefined') {
|
||||
const errPath = resolve(options.errorPath);
|
||||
// tslint:disable-next-line:no-magic-numbers
|
||||
writeFileSync(errPath, JSON.stringify(result.errors, null, 2));
|
||||
Logger.ok(`Mapping errors written to ${errPath}.`);
|
||||
}
|
||||
});
|
||||
|
||||
commander
|
||||
|
||||
Reference in New Issue
Block a user