blob: 1bfc9ec0b5ea12a95055dba1b2c67bcf29761440 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
|