We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b02158 commit 29a7162Copy full SHA for 29a7162
1 file changed
rfc-frontmatter.js
@@ -0,0 +1,26 @@
1
+const argv = require('yargs').command(
2
+ '* path',
3
+ 'return the frontmatter of the RFC as JSON',
4
+ (yargs) => {
5
+ return yargs
6
+ .positional('path', {
7
+ describe: 'file path of the RFC',
8
+ type: 'string',
9
+ })
10
+ .demandOption(['path']);
11
+ }
12
+).argv;
13
+
14
+const frontmatter = require('@github-docs/frontmatter');
15
+const { readFileSync } = require('fs');
16
17
+let markdown = readFileSync(argv.path, 'utf8');
18
+const { data, errors } = frontmatter(markdown);
19
20
+if (errors.length) {
21
+ console.error(JSON.stringify(errors));
22
+ process.exitCode = 1;
23
+ return;
24
+}
25
26
+console.log(JSON.stringify(data));
0 commit comments