From d55fbe748e1d3fab3ac986801c1324d330f56ff0 Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Thu, 12 Apr 2018 13:29:21 +0000 Subject: [PATCH] add parsing of --link-* cli args --- cli.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli.js b/cli.js index 12bfd97..d4cf5ff 100644 --- a/cli.js +++ b/cli.js @@ -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') .alias('n', 'no-readme') .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) { if (!fs.existsSync(args.input)) { throw 'Input file "' + args.input + '" does not exist!'; @@ -45,6 +46,9 @@ var argv = require('optimist') }) .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 }); ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json')); var schemaPathMap = {}; -- GitLab