Skip to content

Commit fd52027

Browse files
OrKoNjgraham
authored andcommitted
scripts: allow passing the spec as an argument
1 parent 10194ce commit fd52027

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

scripts/cddl/generate.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
#!/usr/bin/env node
22

3+
/**
4+
* Usage: node generate.js [pathToSpec]
5+
*
6+
* Parameters
7+
*
8+
* - pathToSpec: a path to the specification to extract CDDL definitions from. Default: _dirname/../../index.bs.
9+
*/
10+
311
const fs = require('fs')
412
const path = require('path')
513
const parse5 = require('parse5')
614

715
const { getCDDLNodes } = require('./utils')
816

9-
const spec = path.resolve(__dirname, '..', '..', 'index.bs')
17+
const spec = process.argv[2] || path.resolve(__dirname, '..', '..', 'index.bs')
1018
const specContent = fs.readFileSync(spec, 'utf-8')
1119
const specParsed = parse5.parse(specContent)
1220

0 commit comments

Comments
 (0)