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 << " API Reference" << endl; // Generate initial list of commands - f << " Kea currently supports " << cmds_.size() << " commands:" << endl - << " " << endl; + f << " Kea currently supports " << cmds_.size() << " commands:" << endl; + bool first = true; for (auto cmd : cmds_) { - f << " " << cmd.first << "" << endl; + if (!first) { + f << ", "; + } + f << "" << cmd.first << "" << endl; + first = false; } - f << " " << endl; - f << " " << endl; + f << "." << 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