getcommands almost ready with dumping data

This commit is contained in:
openshwprojects
2023-03-06 08:39:39 +01:00
parent b62d382a36
commit cfab370605

View File

@ -51,6 +51,7 @@ function getFolder(name, cb){
// like CMD_RegisterCommand("SetChannel", "", CMD_SetChannel, "qqqqq0", NULL);
//parse enum starting with "typedef enum channelType_e {"
/*
if (headerFile && line.startsWith('typedef enum channelType_e {')) {
newlines.push(lines[i]);
let j;
@ -139,6 +140,7 @@ function getFolder(name, cb){
}
i = j;
}
*/
if (headerFile && line.startsWith('typedef enum channelType_e {')) {
newlines.push(lines[i]);
let j;
@ -692,6 +694,16 @@ Do not add anything here, as it will overwritten with next rebuild.
|:------------- | -----:|
`;
let constantsmdshort =
`# Constants (script variables)
Here is the latest, up to date constants list.
This file was autogenerated by running 'node scripts/getcommands.js' in the repository.
All descriptions were taken from code.
Constants can be accessed in commands, so things like setChannel 15 2*$CH14+5 can work.
Do not add anything here, as it will overwritten with next rebuild.
| Code | Description |
|:------------- | -----:|
`;
let mdshort =
`# Commands
Here is the latest, up to date command list.
@ -751,6 +763,19 @@ mdlong += '\n';
for (let i = 0; i < cnsts.length; i++) {
let cn = cnsts[i];
let textshort = `| ${cn.name} | ${cn.descr} |`;
// allow multi-row entries in table entries.
textshort = textshort.replace(/\n/g, '<br/>');
constantsmdshort += textshort;
constantsmdshort += '\n';
}
for (let i = 0; i < drvs.length; i++) {
@ -822,7 +847,7 @@ fs.writeFileSync(`${dirPath}/flags.json`, JSON.stringify(flags, null, 2));
console.log('wrote json/flags.json');
fs.writeFileSync(`${dirPath}/drivers.json`, JSON.stringify(drvs, null, 2));
console.log('wrote json/drivers.json');
fs.writeFileSync(`${dirPath}/constants.json`, JSON.stringify(drvs, null, 2));
fs.writeFileSync(`${dirPath}/constants.json`, JSON.stringify(cnsts, null, 2));
console.log('wrote json/constants.json');
fs.writeFileSync('docs/channelTypes.md', channelsmdshort);
@ -833,6 +858,16 @@ fs.writeFileSync('docs/commands.md', mdshort);
console.log('wrote commands.md');
fs.writeFileSync('docs/flags.md', flagsmdshort);
console.log('wrote flags.md');
fs.writeFileSync('docs/constants.md', constantsmdshort);
console.log('wrote constants.md');
fs.writeFileSync('docs/commands-extended.md', mdlong);
console.log('wrote commands-extended.md');
console.log("All done, stats:");
console.log(commands.length + " commands");
console.log(drvs.length + " drivers");
console.log(cnsts.length + " constans");
console.log(flags.length + " flags");
console.log(ios.length + " IO roles");
console.log(channels.length + " channel types");