mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
committed by
Wieland Schöbl
parent
969badfb29
commit
7b198f95ce
25
src/cli.ts
25
src/cli.ts
@@ -22,6 +22,7 @@ import {
|
||||
readFilePromisified,
|
||||
toArray,
|
||||
} from './common';
|
||||
import {generateTemplate} from './mapping';
|
||||
import {pack} from './pack';
|
||||
import {
|
||||
gatherRouteInformation,
|
||||
@@ -77,6 +78,30 @@ commander
|
||||
Logger.ok(`Route documentation written to ${mdPath}.`);
|
||||
});
|
||||
|
||||
commander
|
||||
.command('mapping <srcPath> <destPath> [ignoredTags]')
|
||||
.action(async (relativeSrcPath, relativeMappingPath, ignoredTags) => {
|
||||
// get absolute paths
|
||||
const srcPath = resolve(relativeSrcPath);
|
||||
const mappingPath = resolve(relativeMappingPath);
|
||||
|
||||
let ignoredTagsList: string[] = [];
|
||||
if (typeof ignoredTags === 'string') {
|
||||
ignoredTagsList = ignoredTags.split(',');
|
||||
}
|
||||
|
||||
// get project reflection
|
||||
const projectReflection = getProjectReflection(srcPath);
|
||||
|
||||
const mapping = generateTemplate(projectReflection, ignoredTagsList);
|
||||
|
||||
// write documentation to file
|
||||
// tslint:disable-next-line:no-magic-numbers
|
||||
writeFileSync(mappingPath, JSON.stringify(mapping.template, null, 2));
|
||||
|
||||
Logger.ok(`Elasticsearch mapping written to ${mappingPath}.`);
|
||||
});
|
||||
|
||||
commander
|
||||
.command('schema <srcPath> <schemaPath>')
|
||||
.action(async (relativeSrcPath, relativeSchemaPath) => {
|
||||
|
||||
Reference in New Issue
Block a user