mirror of
https://github.com/hsjobeki/noogle.git
synced 2024-12-26 15:34:25 +03:00
37 lines
477 B
JavaScript
37 lines
477 B
JavaScript
|
// simple script
|
||
|
// test.json in generated with "cargo run -- --dir ./test"
|
||
|
const data = require("./test.json");
|
||
|
const fs = require("fs");
|
||
|
|
||
|
const all_docs = data.reduce(
|
||
|
(acc, doc) => `${acc}
|
||
|
## ${doc.name}
|
||
|
|
||
|
### Description
|
||
|
|
||
|
\`\`\`nix
|
||
|
${doc.description}
|
||
|
\`\`\`
|
||
|
|
||
|
### Example
|
||
|
|
||
|
\`\`\`nix
|
||
|
${doc.example}
|
||
|
\`\`\`
|
||
|
|
||
|
### Type
|
||
|
|
||
|
\`\`\`nix
|
||
|
${doc.fn_type}
|
||
|
\`\`\`
|
||
|
|
||
|
`,
|
||
|
""
|
||
|
);
|
||
|
|
||
|
fs.writeFile("content.md", `# Functions\n${all_docs}`, (err) => {
|
||
|
if (err) {
|
||
|
console.error(err);
|
||
|
}
|
||
|
});
|