Skip to content
Snippets Groups Projects
Commit d55fbe74 authored by Lars Trieloff's avatar Lars Trieloff
Browse files

add parsing of --link-* cli args

parent 50e7ef15
Branches
Tags
No related merge requests found
...@@ -35,6 +35,7 @@ var argv = require('optimist') ...@@ -35,6 +35,7 @@ var argv = require('optimist')
.describe('x', 'output JSON Schema files including description and validated examples in the _new folder at output directory') .describe('x', 'output JSON Schema files including description and validated examples in the _new folder at output directory')
.alias('n', 'no-readme') .alias('n', 'no-readme')
.describe('n', 'Do not generate a README.md file in the output directory') .describe('n', 'Do not generate a README.md file in the output directory')
.describe('link-*', 'Add this file as a link the explain the * attribute, e.g. --link-abstract=abstract.md')
.check(function(args) { .check(function(args) {
if (!fs.existsSync(args.input)) { if (!fs.existsSync(args.input)) {
throw 'Input file "' + args.input + '" does not exist!'; throw 'Input file "' + args.input + '" does not exist!';
...@@ -45,6 +46,9 @@ var argv = require('optimist') ...@@ -45,6 +46,9 @@ var argv = require('optimist')
}) })
.argv; .argv;
const docs = _.fromPairs(_.toPairs(argv).filter(([ key, value ]) => { return key.startsWith('link-'); }).map(([ key, value ]) => { return [ key.substr(5), value ];}));
console.log(docs);
var ajv = new Ajv({ allErrors: true, messages:true }); var ajv = new Ajv({ allErrors: true, messages:true });
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json')); ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
var schemaPathMap = {}; var schemaPathMap = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment