diff options
author | Tomek Mrugalski <tomasz@isc.org> | 2018-06-13 00:53:43 +0200 |
---|---|---|
committer | Tomek Mrugalski <tomasz@isc.org> | 2019-10-29 18:57:13 +0100 |
commit | c370715fcd6caad855da395a14c31e9eb46358d0 (patch) | |
tree | 043d0b7cce4f9e3621f247c79fc1a78138cf0a99 /tools | |
parent | [5422] reservation-{add,del,get} documented. (diff) | |
download | kea-c370715fcd6caad855da395a14c31e9eb46358d0.tar.xz kea-c370715fcd6caad855da395a14c31e9eb46358d0.zip |
[5422] template generator added
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cmd-docgen/.gitignore | 1 | ||||
-rw-r--r-- | tools/cmd-docgen/cmd_docgen.cc | 13 | ||||
-rwxr-xr-x | tools/cmd-docgen/generate-templates | 18 |
3 files changed, 27 insertions, 5 deletions
diff --git a/tools/cmd-docgen/.gitignore b/tools/cmd-docgen/.gitignore new file mode 100644 index 0000000000..a6c57f5fb2 --- /dev/null +++ b/tools/cmd-docgen/.gitignore @@ -0,0 +1 @@ +*.json diff --git a/tools/cmd-docgen/cmd_docgen.cc b/tools/cmd-docgen/cmd_docgen.cc index 7febabeed9..027a145bd9 100644 --- a/tools/cmd-docgen/cmd_docgen.cc +++ b/tools/cmd-docgen/cmd_docgen.cc @@ -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); diff --git a/tools/cmd-docgen/generate-templates b/tools/cmd-docgen/generate-templates new file mode 100755 index 0000000000..7f5353f379 --- /dev/null +++ b/tools/cmd-docgen/generate-templates @@ -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 |