summaryrefslogtreecommitdiffstats
path: root/src/share/api/generate-templates
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:36:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:36:04 +0000
commit040eee1aa49b49df4698d83a05af57c220127fd1 (patch)
treef635435954e6ccde5eee9893889e24f30ca68346 /src/share/api/generate-templates
parentInitial commit. (diff)
downloadisc-kea-upstream.tar.xz
isc-kea-upstream.zip
Adding upstream version 2.2.0.upstream/2.2.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/share/api/generate-templates')
-rwxr-xr-xsrc/share/api/generate-templates43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/share/api/generate-templates b/src/share/api/generate-templates
new file mode 100755
index 0000000..1bfc9ec
--- /dev/null
+++ b/src/share/api/generate-templates
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# This script generates API documentation templates.
+# Usage:
+#
+# ./generate-templates cmd...
+#
+# Arguments are a list of new commands.
+# The templates will be created in local directory.
+
+if [ $# -eq 0 ]; then
+ echo "Usage: ./generate-templates cmd..."
+ exit
+fi
+
+while [ $# -ne 0 ]; do
+ CMD="$1"
+ shift
+ F=$CMD.json
+
+ if [ -e "$F" ]; then
+ echo "$F exists, skipping"
+ continue;
+ fi
+ echo "{" > "$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\": \"0.0.0\"," >> "$F"
+ echo " \"hook\": \"undocumented\"," >> "$F"
+ echo " \"access\": \"write\"," >> $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\" ]," >> "$F"
+ echo " \"resp-comment\": [ \"Optional extra comments after the response syntax.\" ]" >> "$F"
+ echo "}" >> "$F"
+
+ echo "$CMD generated."
+done