summaryrefslogtreecommitdiffstats
path: root/src/share/api/generate-templates
diff options
context:
space:
mode:
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