-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·30 lines (26 loc) · 788 Bytes
/
cli.js
File metadata and controls
executable file
·30 lines (26 loc) · 788 Bytes
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
#! /usr/bin/env node
const fs = require('fs');
const path = require('path');
const JsonSchemaStaticDocs = require('./lib/json-schema-static-docs');
var argv = require('optimist')
.usage('Convert json schema into markdown docs.')
.demand('i')
.demand('o')
.alias('i', 'inputPath')
.describe('i', 'path to input directory')
.alias('o', 'outputPath')
.describe('o', 'path to output directory')
.check(function(args) {
if (!fs.existsSync(args.inputPath)) {
throw 'Input path "' + args.inputPath + '" does not exist.';
}
})
.argv;
( async () => {
let jsonSchemaStaticDocs = new JsonSchemaStaticDocs({
inputPath: argv.i,
outputPath: argv.o
});
await jsonSchemaStaticDocs.generate();
console.log('Documents generated into ' + argv.o);
})();