2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[5422] template generator added

This commit is contained in:
Tomek Mrugalski
2018-06-13 00:53:43 +02:00
parent 49bfad5bef
commit c370715fcd
3 changed files with 27 additions and 5 deletions

1
tools/cmd-docgen/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.json

View File

@@ -131,15 +131,18 @@ public:
f << " <title>API Reference</title>" << endl;
// Generate initial list of commands
f << " <para>Kea currently supports " << cmds_.size() << " commands:" << endl
<< " <orderedlist>" << endl;
f << " <para>Kea currently supports " << cmds_.size() << " commands:" << endl;
bool first = true;
for (auto cmd : cmds_) {
f << " <listitem><simpara>" << cmd.first << "</simpara></listitem>" << endl;
if (!first) {
f << ", ";
}
f << "<command>" << cmd.first << "</command>" << endl;
first = false;
}
f << " </orderedlist>" << endl;
f << " </para>" << endl;
f << ".</para>" << endl;
// Generate actual commands references.
generateCommands(f);

View File

@@ -0,0 +1,18 @@
#!/bin/bash
while read -r LINE; do
F=$LINE.json
echo "{" > $F
echo " \"name\": \"$LINE\",\n" >> $F
echo " \"brief\": \"a sentence or two explaining what this command does\",\n" >> $F
echo " \"support\": [ \"kea-dhcp4\", \"kea-dhcp6\" ],\n" >> $F
echo " \"avail\": \"first version, possible a hook library name and (premium) if applicable\",\n" >> $F
echo " \"cmd-syntax\": \"Syntax of the command\",\n" >> $F
echo " \"cmd-comment\": \"Possibly some extra comments after the syntax.\",\n" >> $F
echo " \"resp-syntax\": \"Syntax of the response\",\n" >> $F
echo " \"resp-comment\": \"Optional extra comments after the respone syntax.\"\n" >> $F
echo "}" >> $F
echo "$LINE generated."
done < cmds-list