]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#10,!3] generate-templates script updated
authorTomek Mrugalski <tomasz@isc.org>
Tue, 2 Oct 2018 13:01:09 +0000 (15:01 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Tue, 29 Oct 2019 17:57:13 +0000 (18:57 +0100)
doc/Makefile.am
doc/docgen/generate-templates

index 1237c598ca71d80ccf96480021683f77138f177c..98c3de0377b1f26dd76806c163909451c6677d17 100644 (file)
@@ -74,6 +74,12 @@ guide:
 clean:
        rm -rf html
 
+templates:
+       docgen/generate-templates docgen/cmds-list
+
+api: templates
+       docgen/kea-docgen api/*.json
+
 # That's a bit of a hack, but we are making sure that devel target
 # is always valid. The alternative is to make devel depend on all
 # *.cc *.h files in the whole tree.
index 7f5353f379d742406531fb658ddaaf06a10985a8..c38f69b8e14ca978114b1725a7604addea042f9b 100755 (executable)
@@ -1,18 +1,44 @@
 #!/bin/bash
-while read -r LINE; do
-    F=$LINE.json
+
+# This script generates API documentation templates.
+# Usage:
+#
+# ./generate-templates file
+#
+# File is expected to have a list of commands, one per line.
+# The templates will be created in api/ directory.
+
+if (( $# != 1 )); then
+    echo "Usage: ./generate-templates file"
+    echo
+    echo "File specifies a plain text file with each line having name of a command"
+    exit
+fi
+
+
+mkdir -p api/
+
+while read -r CMD; do
+    F=api/$CMD.json
+
+    if [ -e $F ]; then
+        echo "$F exists, skipping"
+        continue;
+    fi
     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 "    \"name\": \"$CMD\"," >> $F
+    echo "    \"brief\": \"a sentence or two explaining what this command does\"," >> $F
+    echo "    \"description\": \"See <xref linkend=\\\"cmd-$LINE\\\"/>\"," >> $F
+    echo "    \"support\": [ \"undocumented\" ]," >> $F
+    echo "    \"avail\": \"first Kea version this command appeared in\"," >> $F
+    echo "    \"hook\": \"\"," >> $F
 
-    echo "    \"cmd-syntax\": \"Syntax of the command\",\n" >> $F
-    echo "    \"cmd-comment\": \"Possibly some extra comments after the syntax.\",\n" >> $F
+    echo "    \"cmd-syntax\": \"Syntax of the command\"," >> $F
+    echo "    \"cmd-comment\": \"Possibly some extra comments after the syntax.\"," >> $F
 
-    echo "    \"resp-syntax\": \"Syntax of the response\",\n" >> $F
-    echo "    \"resp-comment\": \"Optional extra comments after the respone syntax.\"\n" >> $F
+    echo "    \"resp-syntax\": \"Syntax of the response\"," >> $F
+    echo "    \"resp-comment\": \"Optional extra comments after the resposne syntax.\"" >> $F
     echo "}" >> $F
 
-    echo "$LINE generated."
-done < cmds-list
+    echo "$CMD generated."
+done < $1